summaryrefslogtreecommitdiff
path: root/cipher/test-getrusage.c
diff options
context:
space:
mode:
Diffstat (limited to 'cipher/test-getrusage.c')
-rw-r--r--cipher/test-getrusage.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/cipher/test-getrusage.c b/cipher/test-getrusage.c
index 87a404d1..479eaab8 100644
--- a/cipher/test-getrusage.c
+++ b/cipher/test-getrusage.c
@@ -45,5 +45,61 @@ main (int argc, char **argv)
printf ("ru_nvcsw = %ld\n", buf.ru_nvcsw );
printf ("ru_nivcsw = %ld\n", buf.ru_nivcsw );
+ fprintf (stderr, "ru_utime ru_stime ru_minflt ru_nccsw ru_nivcsw\n");
+ fprintf (stderr, "%ld.%06ld %ld.%06ld %5ld %5ld %5ld\n");
+
+
return 0;
}
+
+
+/* Codesnippet for debugging in random.c. */
+#if 0
+static void
+collect_rusage_stats (struct rusage *rb)
+{
+ static int idx;
+ static struct rusage buf[100];
+
+ if (!rb)
+ {
+ int i;
+
+ fprintf (stderr, "ru_utime ru_stime ru_minflt ru_nvcsw ru_nivcsw\n");
+ for (i=0; i < idx; i++)
+ fprintf (stderr, "%ld.%06ld %ld.%06ld %5ld %5ld %5ld\n",
+ buf[i].ru_utime.tv_sec, buf[i].ru_utime.tv_usec,
+ buf[i].ru_stime.tv_sec, buf[i].ru_stime.tv_usec,
+ buf[i].ru_minflt,
+ buf[i].ru_nvcsw,
+ buf[i].ru_nivcsw);
+ }
+ else if (idx < DIM(buf))
+ {
+ buf[idx++] = *rb;
+ }
+}
+#endif
+/*
+ void
+ _gcry_random_dump_stats()
+ {
+@@ -233,8 +261,11 @@
+ rndstats.naddbytes, rndstats.addbytes,
+ rndstats.mixkey, rndstats.ngetbytes1, rndstats.getbytes1,
+ rndstats.ngetbytes2, rndstats.getbytes2 );
++
++ collect_rusage_stats (NULL);
+ }
+
+========
+
+ getrusage (RUSAGE_SELF, &buf );
++ collect_rusage_stats (&buf);
+ add_randomness( &buf, sizeof buf, 1 );
+ memset( &buf, 0, sizeof buf );
+ }
+
+*/
+
+