Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
profile_node.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3 * Author: Martin Rupp
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33#ifndef __H_UG__PROFILE_NODE__
34#define __H_UG__PROFILE_NODE__
35
36#include <string>
37#include <vector>
38#include <sstream>
39
40namespace ug
41{
42
52#if SHINY_PROFILER
53: public Shiny::ProfileNode
54#endif
55{
56public:
58 double get_avg_entry_count() const;
59
61 double get_avg_self_time_ms() const;
62
64 double get_avg_total_time_ms() const;
65
67 double get_avg_self_time() const;
68
70 double get_avg_total_time() const;
71
72 double get_self_mem() const;
73 double get_total_mem() const;
74
79 std::string call_tree(double dSkipMarginal) const;
80 std::string call_tree() const { return call_tree(0.0); }
81
86 std::string child_self_time_sorted(double dSkipMarginal) const;
87 std::string child_self_time_sorted() const { return child_self_time_sorted(0.0); }
88
93 std::string total_time_sorted(double dSkipMarginal) const;
94 std::string total_time_sorted() const { return total_time_sorted(0.0); }
95
96
101 std::string child_self_memory_sorted(double dSkipMarginal) const;
102 std::string child_self_memory_sorted() const { return child_self_memory_sorted(0.0); }
103
108 std::string total_memory_sorted(double dSkipMarginal) const;
109 std::string total_memory_sorted() const { return total_memory_sorted(0.0); }
110
111
116 std::string entry_count_sorted(double dSkipMarginal) const;
117 std::string entry_count_sorted() const { return entry_count_sorted(0.0); }
118
122 std::string groups() const;
123
125 bool valid() const;
126
127 static const UGProfileNode *get_root();
128
129 static void CheckForTooSmallNodes();
130#if SHINY_PROFILER
131
132public:
133 const UGProfileNode *get_first_child() const;
134 const UGProfileNode *get_last_child() const;
135 const UGProfileNode *get_next_sibling() const;
136 const UGProfileNode *find_next_in_tree() const;
137
138
143 void PDXML_rec_write(std::ostream &s) const;
144
152 std::string print_node(double fullMs, double fullMem, size_t offset=0) const;
153
158 void rec_add_nodes(std::vector<const UGProfileNode*> &nodes) const;
159
160 static void log_header(std::stringstream &s, const char *name);
161private:
162 void check_for_too_small_nodes(double fullMs, std::map<std::string, const UGProfileNode *> &list) const;
163
168 std::string get_mem_info(double fullMem) const;
169
170
180 void rec_print(double fullMs, double fullMem, std::stringstream &s, size_t offset, double dSkipMarginal) const;
181
182
190 std::string print_child_sorted(const char *name, bool sortFunction(const UGProfileNode *a, const UGProfileNode *b),
191 double dSkipMarginal) const;
192
193 // sort functions
194 static bool self_time_sort(const UGProfileNode *a, const UGProfileNode *b);
195 static bool total_time_sort(const UGProfileNode *a, const UGProfileNode *b);
196 static bool self_memory_sort(const UGProfileNode *a, const UGProfileNode *b);
197 static bool total_memory_sort(const UGProfileNode *a, const UGProfileNode *b);
198 static bool entry_count_sort(const UGProfileNode *a, const UGProfileNode *b);
199#endif
200
201 // do NOT add variables or virtual functions here (see above).
202};
203
204
207: public UGProfileNode
208{
209 public:
211 {
212 static UGProfileNodeNull instance;
213 return &instance;
214 }
215
216 private:
218 UGProfileNodeNull(UGProfileNodeNull const&); // do not implement
219 void operator=(UGProfileNodeNull const&); // do not implement
220};
221
222#define PROFILER_NULL_NODE UGProfileNodeNull::getInstance()
223
224
225const UGProfileNode *GetProfileNode(const char *name);
226const UGProfileNode *GetProfileNode(const char *name, const UGProfileNode *node);
228
230void WriteProfileDataXML(const char *filename);
231
233
236void WriteProfileDataXML(const char *filename, int procId);
237
238void WriteCallLog(const char *filename);
239void WriteCallLog(const char *filename, int procId);
240
241}
242
243
244#endif /* __H_UG__PROFILE_NODE__ */
location name
Definition checkpoint_util.lua:128
Definition profile_node.h:55
std::string total_memory_sorted() const
Definition profile_node.h:109
static void CheckForTooSmallNodes()
Definition profile_node.cpp:1063
bool valid() const
Definition profile_node.cpp:1023
std::string groups() const
Definition profile_node.cpp:1028
double get_avg_self_time_ms() const
Definition profile_node.cpp:953
std::string total_time_sorted() const
Definition profile_node.h:94
std::string child_self_time_sorted() const
Definition profile_node.h:87
double get_self_mem() const
Definition profile_node.cpp:969
double get_avg_entry_count() const
Definition profile_node.cpp:947
std::string call_tree() const
Definition profile_node.h:80
double get_total_mem() const
Definition profile_node.cpp:964
static const UGProfileNode * get_root()
double get_avg_total_time_ms() const
Definition profile_node.cpp:959
std::string child_self_memory_sorted() const
Definition profile_node.h:102
double get_avg_self_time() const
double get_avg_total_time() const
std::string entry_count_sorted() const
Definition profile_node.h:117
This singleton represents a UGProfileNode that has not been found.
Definition profile_node.h:208
UGProfileNodeNull(UGProfileNodeNull const &)
static UGProfileNodeNull * getInstance()
Definition profile_node.h:210
UGProfileNodeNull()
Definition profile_node.h:217
void operator=(UGProfileNodeNull const &)
if(!(yy_init))
Definition lexer.cpp:997
the ug namespace
void WriteCallLog(const char *filename)
Definition profile_node.cpp:1068
void WriteProfileDataXML(const char *filename)
Writes profile data of process 0 to the specified file.
Definition profile_node.cpp:1043
bool GetProfilerAvailable()
Definition profile_node.cpp:1053
const UGProfileNode * GetProfileNode(const char *name)
Definition profile_node.cpp:1033