Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158313
b: refs/heads/master
c: 849abde
h: refs/heads/master
i:
  158311: 809c8cb
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Sep 4, 2009
1 parent 112be2e commit b6d38e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a02631a470d6f2ccec7bcf79c1058b0d4240bce
refs/heads/master: 849abde92bd3314a4894f2b4f70b30c2accf8653
31 changes: 14 additions & 17 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static int null_run = 0;

static int fd[MAX_NR_CPUS][MAX_COUNTERS];

static u64 event_res[MAX_COUNTERS][3];
static int event_scaled[MAX_COUNTERS];

struct stats
Expand Down Expand Up @@ -179,14 +178,12 @@ static inline int nsec_counter(int counter)
*/
static void read_counter(int counter)
{
u64 *count, single_count[3];
u64 count[3], single_count[3];
unsigned int cpu;
size_t res, nv;
int scaled;
int i;

count = event_res[counter];

count[0] = count[1] = count[2] = 0;

nv = scale ? 3 : 1;
Expand Down Expand Up @@ -318,13 +315,16 @@ static int run_perf_stat(int argc __used, const char **argv)
return WEXITSTATUS(status);
}

static void print_noise(double avg, double stddev)
static void print_noise(int counter, double avg)
{
if (run_count > 1)
fprintf(stderr, " ( +- %7.3f%% )", 100*stddev / avg);
if (run_count == 1)
return;

fprintf(stderr, " ( +- %7.3f%% )",
100 * stddev_stats(&event_res_stats[counter][0]) / avg);
}

static void nsec_printout(int counter, double avg, double stddev)
static void nsec_printout(int counter, double avg)
{
double msecs = avg / 1e6;

Expand All @@ -334,10 +334,9 @@ static void nsec_printout(int counter, double avg, double stddev)
fprintf(stderr, " # %10.3f CPUs ",
avg / avg_stats(&walltime_nsecs_stats));
}
print_noise(avg, stddev);
}

static void abs_printout(int counter, double avg, double stddev)
static void abs_printout(int counter, double avg)
{
fprintf(stderr, " %14.0f %-24s", avg, event_name(counter));

Expand All @@ -348,30 +347,28 @@ static void abs_printout(int counter, double avg, double stddev)
fprintf(stderr, " # %10.3f M/sec",
1000.0 * avg / avg_stats(&runtime_nsecs_stats));
}
print_noise(avg, stddev);
}

/*
* Print out the results of a single counter:
*/
static void print_counter(int counter)
{
double avg, stddev;
double avg = avg_stats(&event_res_stats[counter][0]);
int scaled = event_scaled[counter];

avg = avg_stats(&event_res_stats[counter][0]);
stddev = stddev_stats(&event_res_stats[counter][0]);

if (scaled == -1) {
fprintf(stderr, " %14s %-24s\n",
"<not counted>", event_name(counter));
return;
}

if (nsec_counter(counter))
nsec_printout(counter, avg, stddev);
nsec_printout(counter, avg);
else
abs_printout(counter, avg, stddev);
abs_printout(counter, avg);

print_noise(counter, avg);

if (scaled) {
double avg_enabled, avg_running;
Expand Down

0 comments on commit b6d38e8

Please sign in to comment.