[libgtop] Display self-timings using `ps`.
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgtop] Display self-timings using `ps`.
- Date: Thu, 25 Jun 2015 23:59:42 +0000 (UTC)
commit 1f3b08e6dc1a0412976ad0eeb06af2505e13807d
Author: Benoit Dejean <bdejean gmail com>
Date: Sun Jun 21 17:35:57 2015 +0200
Display self-timings using `ps`.
examples/timings.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/examples/timings.c b/examples/timings.c
index c2ce2d1..6c85da0 100644
--- a/examples/timings.c
+++ b/examples/timings.c
@@ -69,6 +69,21 @@
} \
} while (0)
+
+static void display_self_times(void)
+{
+ printf("-- Overview using `ps` --------------------"
+ "---------------\n");
+ printf("-- this client is %8u ----------------"
+ "---------------\n", (unsigned)getpid());
+ printf("-- this server is %8u ----------------"
+ "---------------\n", (unsigned)glibtop_global_server->pid);
+ system("ps xjf | egrep 'timings|libgtop_server'");
+ printf("-------------------------------------------"
+ "---------------\n");
+}
+
+
int
main (int argc, char *argv [])
{
@@ -85,13 +100,16 @@ main (int argc, char *argv [])
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
textdomain (GETTEXT_PACKAGE);
+
+ glibtop_init_r (&glibtop_global_server, 0, 0);
+
+ display_self_times();
+
printf ("%-12s (%-10s): %7s - %9s - %9s\n",
"Feature", "Flags", "Count", "utime", "stime");
printf ("-------------------------------------------"
"---------------\n");
- glibtop_init_r (&glibtop_global_server, 0, 0);
-
getrusage (RUSAGE_SELF, &total_start);
getrusage (RUSAGE_SELF, &rusage_start);
@@ -411,6 +429,8 @@ main (int argc, char *argv [])
printf ("All timings are in clock ticks "
"(1000000 ticks per second).\n\n");
+ display_self_times();
+
glibtop_close ();
exit (0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]