Skip to content

Commit

Permalink
Fixing bugs on osx, formatting screen output to fit in 130 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Dec 13, 2022
1 parent 4793c1c commit c0d7c80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
5 changes: 3 additions & 2 deletions src/apex/address_resolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
#include <unordered_map>
#include <execinfo.h>
#include <unistd.h>
#include <elf.h>
#include <stdio.h>
#include <string.h>
#include <link.h>

#ifdef __APPLE__
#include <dlfcn.h>
#define _XOPEN_SOURCE 600 /* Single UNIX Specification, Version 3 */
#if defined(TAU_HAVE_CORESYMBOLICATION)
#include "CoreSymbolication.h"
#endif
#else
// For PIE offset
#include <link.h>
#endif /* __APPLE__ */

using namespace std;
Expand Down
2 changes: 0 additions & 2 deletions src/apex/apex_error_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/

#pragma once

#include <string>
#include <iostream>
#include <signal.h>
Expand Down
39 changes: 20 additions & 19 deletions src/apex/profiler_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,9 @@ std::unordered_set<profile*> free_profiles;

}

#define PAD_WITH_SPACES "%8s"
#define FORMAT_PERCENT "%8.3f"
#define PAD_WITH_SPACES "%6s"
#define FORMAT_PERCENT "%4.1f"
#define FORMAT_FLOAT "%7.2f"
#define FORMAT_SCIENTIFIC "%1.2e"

template<typename ... Args>
Expand Down Expand Up @@ -574,7 +575,7 @@ std::unordered_set<profile*> free_profiles;
screen_output << string_format(FORMAT_SCIENTIFIC,
(p->get_mean_seconds())) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT,
screen_output << string_format(FORMAT_FLOAT,
(p->get_mean_seconds())) << " " ;
}
//screen_output << " --n/a-- " ;
Expand All @@ -586,10 +587,10 @@ std::unordered_set<profile*> free_profiles;
(p->get_accumulated_seconds()/p->get_num_threads())) << " " ;
}
} else {
screen_output << string_format(FORMAT_PERCENT,
screen_output << string_format(FORMAT_FLOAT,
(p->get_accumulated_seconds())) << " " ;
if (include_stops) {
screen_output << string_format(FORMAT_PERCENT,
screen_output << string_format(FORMAT_FLOAT,
(p->get_accumulated_seconds()/p->get_num_threads())) << " " ;
}
}
Expand All @@ -603,15 +604,15 @@ std::unordered_set<profile*> free_profiles;
double tmp = ((p->get_accumulated_seconds())
/total_main)*100.0;
if (tmp > 100.0) {
screen_output << " --n/a--" ;
screen_output << "-n/a- " ;
} else {
screen_output << string_format(FORMAT_PERCENT, tmp);
}
screen_output << " ";
tmp = ((p->get_accumulated_seconds()/p->get_num_threads())
/wall_main)*100.0;
if (tmp > 100.0) {
screen_output << " --n/a--" ;
screen_output << "-n/a- " ;
} else {
screen_output << string_format(FORMAT_PERCENT, tmp);
}
Expand Down Expand Up @@ -692,22 +693,22 @@ std::unordered_set<profile*> free_profiles;
if (action_name.find('%') == string::npos && p->get_minimum() > 10000) {
screen_output << string_format(FORMAT_SCIENTIFIC, p->get_minimum()) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT, p->get_minimum()) << " " ;
screen_output << string_format(FORMAT_FLOAT, p->get_minimum()) << " " ;
}
if (action_name.find('%') == string::npos && p->get_mean() > 10000) {
screen_output << string_format(FORMAT_SCIENTIFIC, p->get_mean()) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT, p->get_mean()) << " " ;
screen_output << string_format(FORMAT_FLOAT, p->get_mean()) << " " ;
}
if (action_name.find('%') == string::npos && p->get_maximum() > 10000) {
screen_output << string_format(FORMAT_SCIENTIFIC, p->get_maximum()) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT, p->get_maximum()) << " " ;
screen_output << string_format(FORMAT_FLOAT, p->get_maximum()) << " " ;
}
if (action_name.find('%') == string::npos && p->get_stddev() > 10000) {
screen_output << string_format(FORMAT_SCIENTIFIC, p->get_stddev()) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT, p->get_stddev()) << " " ;
screen_output << string_format(FORMAT_FLOAT, p->get_stddev()) << " " ;
}
screen_output << endl;
}
Expand Down Expand Up @@ -888,16 +889,16 @@ std::unordered_set<profile*> free_profiles;
}

screen_output << "CPU Timers : "
<< "#calls | #yields | #threads | mean | total | tot/thr | % total | % wall "
<< "#calls| #yields| #thread| mean | total | tot/thr | %total | %wall "
<< tmpstr;
if (apex_options::track_cpu_memory() || apex_options::track_gpu_memory()) {
screen_output << "| allocs | (bytes) | frees | (bytes) ";
screen_output << "| allocs| (bytes)| frees | (bytes) ";
}
screen_output << endl;
screen_output << "--------------------------------------------------------------------"
<< "-------------------------------------------------------------------------";
screen_output << "--------------------------------------------------------------"
<< "---------------------------------------------------------------";
if (apex_options::track_cpu_memory() || apex_options::track_gpu_memory()) {
screen_output << "--------------------------------------------";
screen_output << "-------------------------------------";
}
screen_output << endl;

Expand All @@ -920,9 +921,9 @@ std::unordered_set<profile*> free_profiles;
}
}
screen_output << "--------------------------------------------------------------"
<< "-------------------------------------------------------------------------------";
<< "---------------------------------------------------------------";
if (apex_options::track_cpu_memory() || apex_options::track_gpu_memory()) {
screen_output << "--------------------------------------------";
screen_output << "------------------------------------";
}
screen_output << endl;
screen_output << endl;
Expand All @@ -936,7 +937,7 @@ std::unordered_set<profile*> free_profiles;
if (idle_rate > 10000) {
screen_output << string_format(FORMAT_SCIENTIFIC, idle_rate) << " " ;
} else {
screen_output << string_format(FORMAT_PERCENT, idle_rate) << " " ;
screen_output << string_format(FORMAT_FLOAT, idle_rate) << " " ;
}
screen_output << string_format(FORMAT_PERCENT,
((idle_rate/all_total_main)*100)) << endl;
Expand Down

0 comments on commit c0d7c80

Please sign in to comment.