File: example.tpl

package info (click to toggle)
eztrace 2.0%2Brepack-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,132 kB
  • sloc: ansic: 23,501; perl: 910; sh: 857; cpp: 771; makefile: 696; fortran: 327; f90: 320; python: 57
file content (125 lines) | stat: -rw-r--r-- 2,470 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Copyright (C) CNRS, INRIA, Université Bordeaux 1, Télécom SudParis
# See COPYING in top-level directory.

# There are deliberately trailing whitespace everywhere. This
   # (<-- see?) is for stressing the script parser.
# Sorry for the inconvenience.
 BEGIN_MODULE
NAME example_lib
DESC "module for the example library"
LANGUAGE C
ID 09

BEGIN_INCLUDE
#include <stdio.h>
END_INCLUDE

int example_do_event(    int n)
BEGIN
 EVENT("Do new function")
END

void appli_function1(double* array, int size)
BEGIN
  RECORD_STATE("running appli_function1")
END

double example_function1(double* array, int array_size)

int example_function2(int* array, int array_size)
BEGIN
  RECORD_STATE("running example_function2")
END

int example_fcall(   int* array,
        int array_size )
BEGIN
 CALL_FUNC
END

int example_push (int* array,int array_size)
BEGIN
 PUSH_STATE("doing function example_push")
END


int example_event(int* array, int array_size)
BEGIN
 EVENT("example_event called")
END

int example_set_var(int* array, int array_size)
BEGIN
 SET_VAR("variable name", 5)
END

int example_add_var(int* array,    int array_size)
BEGIN
 ADD_VAR("variable name", 1)
END

 int example_sub_var (    int* array,    int array_size)
BEGIN
 SUB_VAR("variable name", 4)
END


int example_set_var2 (    int* array,    int array_size)
BEGIN
 SET_VAR("another variable name", 21)
END

int example_set_var3(    int* array,    int array_size)
BEGIN
 ADD_VAR("another variable name", 10)
END


 int example_set_var4(    int* array,    int array_size)
BEGIN
 SUB_VAR("another variable name", 3)
END


 int example_set_var5(    int* array,    int array_size)
BEGIN
 SET_VAR("another variable name", 13)
END

int example_set_var6(    int* array,    int array_size)
BEGIN
 ADD_VAR("variable name", 2)
 CALL_FUNC
 SUB_VAR("variable name", 1)
END

 int example_many_args(
      int arg1,
      int arg2,
      int arg3,
      int arg4,
      int arg5,
      int arg6,
      int arg7)
BEGIN
 ADD_VAR("variable name", 2)
 CALL_FUNC
 SUB_VAR("variable name", 1)
END

DEFINE_SAMPLING_FUNCTION (example_sampling, 1000)
int example_sampling(struct ezt_sampling_callback_instance *instance) {
    double *ptr = NULL;
    if(!instance->plugin_data) {
        instance->plugin_data = malloc(sizeof(double));
	ptr = instance->plugin_data;
	*ptr = 0;
    }
    ptr = instance->plugin_data;
    (*ptr) ++;
    if(*ptr>1) {    SAMPLING_RECORD(*ptr, "Value of PTR"); }
    return 0;
}
END_DEFINE

END_MODULE