diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2007-09-27 13:33:53 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2007-09-27 13:33:53 -0400 |
commit | c4123634bf7befe9b1390265b5279d2676b20f51 (patch) | |
tree | f80ecb5a1ab79d46ad9c18ad42abd1f473026f16 /testsuite/systemtap.samples/gtod.c | |
parent | e154a2613d455f3bdf13c8aeb179c8634f1b6bf5 (diff) | |
parent | ff0dba8fb7c752a10d64258d3cc1350893139929 (diff) | |
download | systemtap-steved-c4123634bf7befe9b1390265b5279d2676b20f51.tar.gz systemtap-steved-c4123634bf7befe9b1390265b5279d2676b20f51.tar.xz systemtap-steved-c4123634bf7befe9b1390265b5279d2676b20f51.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.samples/gtod.c')
-rw-r--r-- | testsuite/systemtap.samples/gtod.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/gtod.c b/testsuite/systemtap.samples/gtod.c new file mode 100644 index 00000000..abc08543 --- /dev/null +++ b/testsuite/systemtap.samples/gtod.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <unistd.h> + +int main (int argc, char *argv[]) +{ + int i; + struct timeval tv[100][2]; + int us = 0; + if (argc == 2) us = atoi(argv[1]); + for (i=0; i<100; i++) { + gettimeofday(&tv[i][0], NULL); + setsid(); + gettimeofday(&tv[i][1], NULL); + if (us) usleep(us); + } + for (i=0; i<100; i++) { + // change last 4 chars for correctly sorting even if the + // time stamps are completely same. + printf("%8d%06d :%02d appl\n", tv[i][0].tv_sec, tv[i][0].tv_usec, i); + printf("%8d%06d :%02d prog\n", tv[i][1].tv_sec, tv[i][1].tv_usec, i); + } + return 0; +} + |