Project

General

Profile

Bug #914 » hello.c

hello.c - jia fang, 08/31/2015 09:44 PM

 
1
#include <stdio.h>
2
#include "hello-tp.h"
3

    
4
int main(int argc, char* argv[])
5
{
6
    int x;
7

    
8
    puts("Hello, World!\nPress Enter to continue...");
9

    
10
    /* The following getchar() call is only placed here for the purpose
11
     *      * of this demonstration, for pausing the application in order for
12
     *           * you to have time to list its events. It's not needed otherwise.
13
     *                */
14
    getchar();
15

    
16
    /* A tracepoint() call. Arguments, as defined in hello-tp.tp:
17
     *      *
18
     *           *     1st: provider name (always)
19
     *                *     2nd: tracepoint name (always)
20
     *                     *     3rd: my_integer_arg (first user-defined argument)
21
     *                          *     4th: my_string_arg (second user-defined argument)
22
     *                               *
23
     *                                    * Notice the provider and tracepoint names are NOT strings;
24
     *                                         * they are in fact parts of variables created by macros in
25
     *                                              * hello-tp.h.
26
     *                                                   */
27
    for(;;)
28
    {
29
        sleep(1);
30
    tracepoint(hello_world, my_first_tracepoint, 23, "hi there!");
31

    
32
    for (x = 0; x < argc; ++x) {
33
        tracepoint(hello_world, my_first_tracepoint, x, argv[x]);
34
    }
35
    }
36

    
37
    puts("Quitting now!");
38

    
39
    tracepoint(hello_world, my_first_tracepoint, x * x, "x^2");
40

    
41
    return 0;
42
}
(2-2/2)