My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
profiler.h
Go to the documentation of this file.
1 /*
2 START OF LICENSE STUB
3  DeDOS: Declarative Dispersion-Oriented Software
4  Copyright (C) 2017 University of Pennsylvania, Georgetown University
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 END OF LICENSE STUB
19 */
27 #ifndef PROFILER_H__
28 #define PROFILER_H__
29 #include "msu_message.h"
30 #include "stat_ids.h"
31 #include "rt_stats.h"
32 
34 #define PROFILER_ITEM_ID 101
35 
40 void set_profiling(struct msu_msg_hdr *hdr);
44 void init_profiler(float tag_probability);
45 
46 #ifdef DEDOS_PROFILER
47 
49 #define SET_PROFILING(hdr) set_profiling(&hdr)
50 
53 #define INIT_PROFILER(tprof) init_profiler(tprof)
54 
59 #define PROFILE_EVENT(hdr, stat_id) \
60  if (hdr.do_profile && hdr.key.id != 0) \
61  record_stat(stat_id, PROFILER_ITEM_ID, (double)hdr.key.id, true)
62 #else
63 
65 #define SET_PROFILING(hdr)
66 
69 #define INIT_PROFILER(tprof) \
70  if (tprof > 0) \
71  log_warn("Profiling probability set to %f but profiling is disabled", tprof)
72 
77 #define PROFILE_EVENT(hdr, stat_id)
78 
79 #endif // DEDOS_PROFILER
80 
81 #endif // PROFILER_H__
Collecting statistics within the runtime.
Header for messages passed to MSUs.
Definition: msu_message.h:85
void set_profiling(struct msu_msg_hdr *hdr)
Sets the profiling flag in the header based on the tag_probability provided to init_profiler.
Definition: profiler.c:45
void init_profiler(float tag_probability)
Sets the probability of profiling an MSU message.
Definition: profiler.c:58
static float tag_probability
The probability that an MSU message will get marked for profiling.
Definition: profiler.c:31
Declares the identifiers with which stats can be logged.
Messages passed to MSUs.