"Fossies" - the Fresh Open Source Software Archive 
Member "FunctionCheck-3.2.0/src/fcmanager/fc_context.h" (26 May 2012, 4351 Bytes) of package /linux/privat/old/FunctionCheck-3.2.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 * FunctionCheck profiler
3 * (C) Copyright 2000-2012 Yannick Perret
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* fc_context.h: manage contexts for profile stats */
20
21 /**
22 description of the dump file format.
23 {...} and empty lines are comments
24 **/
25
26 /*
27
28 { general informations }
29
30 functioncheck_v3.0 { header and version control }
31 unique_ID { unique string for a particular execution }
32 time_mode { unit used for time }
33 profile_mode { do fork/thread allowed during profile ? }
34 PID { PID of the profiled program }
35 PPID { PID of the father of the profiled program }
36 exec_time { time elapsed between 1st and last action }
37
38 { call graph }
39
40 nb_elements { number of call arcs }
41 0xfrom 0xto nb { call arc (symbol address) }
42 0xfrom 0xto nb
43 ...
44
45 { functions stats }
46
47 nb_elements { number of functions }
48 0xfunction nb_calls self_time total_time MIN MAX lMIN lMAX
49 0xfunction nb_calls self_time total_time MIN MAX lMIN lMAX
50 ...
51
52 { list of dynamic library used }
53
54 nb_elements { number of libnames }
55 0xaddr_base libname
56 0xaddr_base libname
57 ...
58
59 { memory leaks }
60
61 nb_elements
62 0xblock_addr initial_size 0xlocation 0xrelocation Oxstack 0xstack ... NULL
63 0xblock_addr initial_size 0xlocation 0xrelocation Oxstack 0xstack ... NULL
64 ...
65
66 { invalid free }
67
68 nb_elements
69 0xlocation 0xpointer 0xstack 0xstack ... NULL
70 0xlocation 0xpointer 0xstack 0xstack ... NULL
71 ...
72
73 { invalid realloc }
74
75 nb_elements
76 0xlocation 0xpointer 0xstack 0xstack ... NULL
77 0xlocation 0xpointer 0xstack 0xstack ... NULL
78 ...
79
80 */
81
82 #ifndef __fc_context_h_
83 #define __fc_context_h_
84
85 #include <stdio.h>
86 #include <stdlib.h>
87 #include <unistd.h>
88
89 #include "fc_global.h"
90 #include "fc_com.h"
91 #include "fc_tools.h"
92 #include "fc_stack.h"
93 #include "fc_graph.h"
94 #include "fc_xhash.h"
95 #include "fc_xlhash.h"
96 #include "fc_hash.h"
97 #include "fc_time.h"
98 #include "fc_memory_manager.h"
99
100 /** strings **/
101
102 /** structure of a context **/
103 typedef struct
104 {
105 int id; /* ID of the current context */
106 int pid; /* ID of the parent context */
107 unsigned long long first_time; /* time for the first event */
108 unsigned long long last_time; /* time for the last event */
109 unsigned long long ulast_time; /* time for the last event (ID uint) */
110 unsigned long long time_pad; /* time to add the 'unsigned int' times */
111
112 /* effective data about profile */
113 FC_LHash *graph; /* associated call-graph */
114 FC_Stack *stack; /* associated call stack */
115 FC_FHash *functions; /* associated list of functions */
116 FC_Memory *memory; /* list of memory leaks */
117 }FC_Context;
118
119 /* the active context */
120 extern FC_Context *fc_current_context;
121
122 /** functions **/
123 /* create a new context */
124 FC_Context *fc_context_create(int id, unsigned int first, int stack_size,
125 int func_size, int graph_size, int memory_size);
126
127 /* delete a context */
128 void fc_context_delete(FC_Context *ctx);
129
130 /* set the current context regards to the ID (create it if needed) */
131 void fc_context_set(int id, unsigned int first);
132
133 /* set default values */
134 void fc_context_set_functions(int n);
135 void fc_context_set_graph(int n);
136 void fc_context_set_stack(int n);
137 void fc_context_set_memory(int n);
138 void fc_context_set_name(char *n);
139 void fc_context_set_path(char *n);
140 void fc_context_set_usepid(int n);
141 void fc_context_set_starttime(time_t start);
142 void fc_context_set_stoptime(time_t stop);
143 void fc_context_set_mode(int mode);
144
145 /* save a given context */
146 int fc_context_save(FC_Context *ctx);
147
148 /* save all existing contexts */
149 int fc_context_save_all();
150
151 /* loop on contexts */
152 FC_Context *fc_context_first();
153 FC_Context *fc_context_next();
154
155 /* to manage list of dynamic libraries */
156 int fc_ldyn_add(FC_LDYN *ldyn);
157
158 #endif /* __fc_context_h_ */