[CODIFF]: Show a diff when bytes were removed and added
build/libclasses.so: 36 functions changed, 3334 bytes added, 3348 bytes removed, diff: -14 [acme@newtoy pahole]$ Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
c453da1b35
commit
770f579b71
21
codiff.c
21
codiff.c
|
@ -544,19 +544,26 @@ static int cu_show_diffs_iterator(struct cu *cu, void *cookie)
|
|||
}
|
||||
|
||||
if (cu->nr_functions_changed != 0 && show_function_diffs) {
|
||||
int kind = 0;
|
||||
total_nr_functions_changed += cu->nr_functions_changed;
|
||||
|
||||
cu__for_each_tag(cu, show_function_diffs_iterator, cookie, NULL);
|
||||
printf(" %u function%s changed", cu->nr_functions_changed,
|
||||
cu->nr_functions_changed > 1 ? "s" : "");
|
||||
if (cu->function_bytes_added != 0) {
|
||||
++kind;
|
||||
total_function_bytes_added += cu->function_bytes_added;
|
||||
printf(", %u bytes added", cu->function_bytes_added);
|
||||
}
|
||||
if (cu->function_bytes_removed != 0) {
|
||||
++kind;
|
||||
total_function_bytes_removed += cu->function_bytes_removed;
|
||||
printf(", %u bytes removed", cu->function_bytes_removed);
|
||||
}
|
||||
if (kind == 2)
|
||||
printf(", diff: %+d",
|
||||
(cu->function_bytes_added -
|
||||
cu->function_bytes_removed));
|
||||
putchar('\n');
|
||||
}
|
||||
return 0;
|
||||
|
@ -568,17 +575,27 @@ static int cu_show_new_classes_iterator(struct cu *cu, void *cookie)
|
|||
|
||||
static void print_total_function_diff(const char *filename)
|
||||
{
|
||||
int kind = 0;
|
||||
|
||||
printf("\n%s:\n", filename);
|
||||
|
||||
printf(" %u function%s changed", total_nr_functions_changed,
|
||||
total_nr_functions_changed > 1 ? "s" : "");
|
||||
|
||||
if (total_function_bytes_added != 0)
|
||||
if (total_function_bytes_added != 0) {
|
||||
++kind;
|
||||
printf(", %lu bytes added", total_function_bytes_added);
|
||||
}
|
||||
|
||||
if (total_function_bytes_removed != 0)
|
||||
if (total_function_bytes_removed != 0) {
|
||||
++kind;
|
||||
printf(", %lu bytes removed", total_function_bytes_removed);
|
||||
}
|
||||
|
||||
if (kind == 2)
|
||||
printf(", diff: %+ld",
|
||||
(total_function_bytes_added -
|
||||
total_function_bytes_removed));
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue