2006-12-20 Dmitry V. Levin <ldv@altlinux.org>
Show system call summary for each personality.
* syscall.c (countv): New call_counts pointers array.
(counts): Convert to macro wrapper around countv.
(call_summary_pers): New function.
(call_summary): Use it for each personality.
Fixes RH#192193.
diff --git a/syscall.c b/syscall.c
index 05679ca..d388400 100644
--- a/syscall.c
+++ b/syscall.c
@@ -197,8 +197,7 @@
};;
int
-set_personality(personality)
-int personality;
+set_personality(int personality)
{
switch (personality) {
case 0:
@@ -255,7 +254,8 @@
int calls, errors;
};
-static struct call_counts *counts;
+static struct call_counts *countv[SUPPORTED_PERSONALITIES];
+#define counts (countv[current_personality])
static struct timeval shortest = { 1000000, 0 };
@@ -2740,9 +2740,8 @@
overhead.tv_usec = n % 1000000;
}
-void
-call_summary(outf)
-FILE *outf;
+static void
+call_summary_pers(FILE *outf)
{
int i, j;
int call_cum, error_cum;
@@ -2808,3 +2807,26 @@
call_cum, error_str, "total");
}
+
+void
+call_summary(FILE *outf)
+{
+ int i, old_pers = current_personality;
+
+ for (i = 0; i < SUPPORTED_PERSONALITIES; ++i)
+ {
+ if (!countv[i])
+ continue;
+
+ if (current_personality != i)
+ set_personality(i);
+ if (i)
+ fprintf(outf,
+ "System call usage summary for %u bit mode:\n",
+ personality_wordsize[current_personality] * 8);
+ call_summary_pers(outf);
+ }
+
+ if (old_pers != current_personality)
+ set_personality(old_pers);
+}