diff options
author | Ian Wienand <ianw@ieee.org> | 2006-02-20 22:48:07 +0100 |
---|---|---|
committer | Ian Wienand <ianw@debian.org> | 2006-02-20 22:48:07 +0100 |
commit | 2d45b1a8e26a36a9f85dc49e721c4390ca93dc40 (patch) | |
tree | 4e4f7ef60ae723e64af6495888730f2bc4468b19 /summary.c | |
parent | 9a2ad351a1c3215dc596ff3e2e3fd4bc24445a6b (diff) | |
download | ltrace-2d45b1a8e26a36a9f85dc49e721c4390ca93dc40.tar.gz |
run Lindent over source to get everything looking about the same
Diffstat (limited to 'summary.c')
-rw-r--r-- | summary.c | 45 |
1 files changed, 24 insertions, 21 deletions
@@ -9,16 +9,16 @@ static struct entry_st { char *name; int count; struct timeval tv; -} * entries = NULL; +} *entries = NULL; static int tot_count = 0; static unsigned long int tot_usecs = 0; -static void -fill_struct(void * key, void * value, void * data) { - struct opt_c_struct * st = (struct opt_c_struct *)value; +static void fill_struct(void *key, void *value, void *data) +{ + struct opt_c_struct *st = (struct opt_c_struct *)value; - entries = realloc(entries, (num_entries+1)*sizeof(struct entry_st)); + entries = realloc(entries, (num_entries + 1) * sizeof(struct entry_st)); if (!entries) { perror("realloc()"); exit(1); @@ -28,14 +28,14 @@ fill_struct(void * key, void * value, void * data) { entries[num_entries].tv = st->tv; tot_count += st->count; - tot_usecs += 1000000*st->tv.tv_sec; + tot_usecs += 1000000 * st->tv.tv_sec; tot_usecs += st->tv.tv_usec; num_entries++; } -static int -compar(const void *a, const void *b) { +static int compar(const void *a, const void *b) +{ struct entry_st *en1, *en2; en1 = (struct entry_st *)a; @@ -48,8 +48,8 @@ compar(const void *a, const void *b) { } } -void -show_summary(void) { +void show_summary(void) +{ int i; num_entries = 0; @@ -60,20 +60,23 @@ show_summary(void) { qsort(entries, num_entries, sizeof(*entries), compar); printf("%% time seconds usecs/call calls function\n"); - printf( "------ ----------- ----------- --------- --------------------\n"); - for(i=0; i<num_entries; i++) { + printf + ("------ ----------- ----------- --------- --------------------\n"); + for (i = 0; i < num_entries; i++) { unsigned long long int c; unsigned long long int p; - c = 1000000 * (int)entries[i].tv.tv_sec + (int)entries[i].tv.tv_usec; + c = 1000000 * (int)entries[i].tv.tv_sec + + (int)entries[i].tv.tv_usec; p = 100000 * c / tot_usecs + 5; printf("%3lu.%02lu %4d.%06d %11lu %9d %s\n", - (unsigned long int)(p / 1000), - (unsigned long int)((p / 10) % 100), - (int)entries[i].tv.tv_sec, (int)entries[i].tv.tv_usec, - (unsigned long int)(c / entries[i].count), - entries[i].count, entries[i].name); + (unsigned long int)(p / 1000), + (unsigned long int)((p / 10) % 100), + (int)entries[i].tv.tv_sec, (int)entries[i].tv.tv_usec, + (unsigned long int)(c / entries[i].count), + entries[i].count, entries[i].name); } - printf("------ ----------- ----------- --------- --------------------\n"); - printf("100.00 %4lu.%06lu %9d total\n", - tot_usecs / 1000000, tot_usecs % 1000000, tot_count); + printf + ("------ ----------- ----------- --------- --------------------\n"); + printf("100.00 %4lu.%06lu %9d total\n", tot_usecs / 1000000, + tot_usecs % 1000000, tot_count); } |