doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/at_var_timer_profile.c
raw| 1 | #include <unistd.h> |
| 2 | #include <stdlib.h> |
| 3 | |
| 4 | struct foo |
| 5 | { |
| 6 | int bar; |
| 7 | }; |
| 8 | |
| 9 | static struct foo foo; |
| 10 | |
| 11 | int |
| 12 | sub(int a) |
| 13 | { |
| 14 | int i, j; |
| 15 | for (i = 0; i < 1000; i++) |
| 16 | for (j = 0; j < 1000; j++) |
| 17 | a += i + j + rand(); |
| 18 | return a; |
| 19 | } |
| 20 | |
| 21 | int |
| 22 | main (int argc, char **argv) |
| 23 | { |
| 24 | foo.bar = 41 + argc; /* 42 */ |
| 25 | sub(argc); |
| 26 | return 0; |
| 27 | } |