Flow123d
JS_before_hm-1804-gf2ad740aa
|
#include "global_defs.h"
#include <mpi.h>
#include <ostream>
#include <unordered_map>
#include <boost/functional/hash/hash.hpp>
#include <boost/ref.hpp>
#include <boost/tuple/detail/tuple_basic.hpp>
#include <nlohmann/json.hpp>
#include "time_point.hh"
#include "petscsys.h"
#include "simple_allocator.hh"
Go to the source code of this file.
Classes | |
struct | boost::hash< T > |
class | MPI_Functions |
class | Profiler |
Namespaces | |
boost | |
Macros | |
#define | CONSTEXPR_ constexpr |
#define | _PASTE(a, b) a ## b |
#define | PASTE(a, b) _PASTE(a, b) |
#define | START_TIMER(tag) |
Starts a timer with specified tag. More... | |
#define | START_TIMER_EXT(tag, subtag) |
Starts a timer with specified tag and subtag. More... | |
#define | END_TIMER(tag) |
Ends a timer with specified tag. More... | |
#define | END_START_TIMER(tag) |
#define | ADD_CALLS(n_calls) |
Increase number of calls in actual timer. More... | |
#define | CUMUL_TIMER(tag) |
* Copyright (C) 2015 Technical University of Liberec. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
extended output: cas na jedno volani (jina redukce nez pro kumulativni cas, pokud je pocet volani ruzny) procenta vuci predkovi code point (az nekde na konci radky)
!!! Unfortunately using constexpr is worse (without optimization). This is probably due to use of static variable for CodePoint, the access could be slow, and computation of hash is done only once. Actually timing results are:
OPTIONS OVERHEAD (compared to call 2x clock()) -g, no c++11 : 18% -g, c++11 : 60% -O3,no c++11 : 6% -O3, c++11 : 6%
Definition in file sys_profiler.hh.
#define _PASTE | ( | a, | |
b | |||
) | a ## b |
Definition at line 92 of file sys_profiler.hh.
#define ADD_CALLS | ( | n_calls | ) |
Increase number of calls in actual timer.
Some time you want to measure a performance of a cycle with body that is below resolution of the Timer implementation. If you know number of cycles, you can use this macro in following way:
In the profiler report you get the total time spent in the cycle, and time per one call which will be average time spent in the body of the cycle.
Definition at line 186 of file sys_profiler.hh.
#define CONSTEXPR_ constexpr |
Definition at line 86 of file sys_profiler.hh.
#define CUMUL_TIMER | ( | tag | ) |
Definition at line 193 of file sys_profiler.hh.
#define END_START_TIMER | ( | tag | ) |
Ends current timer and starts the new one with given tag. Again this expands into two lines, see ATTENTION in previous macro.
Definition at line 160 of file sys_profiler.hh.
#define END_TIMER | ( | tag | ) |
Ends a timer with specified tag.
Use only if you want to end timer before the end of block. Again this expands into two lines, see ATTENTION in previous macro.
Definition at line 149 of file sys_profiler.hh.
#define PASTE | ( | a, | |
b | |||
) | _PASTE(a, b) |
Definition at line 93 of file sys_profiler.hh.
#define START_TIMER | ( | tag | ) |
Starts a timer with specified tag.
In fact it creates an static constant expression that identifies the point in the code and contains tag of the involved timer and its hash. Then it creates local variable that calls Profiler::start_timer()
in constructor and Profiler::stop_timer()
in destructor. This way the timer is automatically closed at the end of current block.
ATTENTION: This macro expands to two statements so following code is illegal:
Definition at line 115 of file sys_profiler.hh.
#define START_TIMER_EXT | ( | tag, | |
subtag | |||
) |
Starts a timer with specified tag and subtag.
In fact it creates an static constant expression that identifies the point in the code and contains tag and subtag of the involved timer and its hash. Then it creates local variable that calls Profiler::start_timer()
in constructor and Profiler::stop_timer()
in destructor. This way the timer is automatically closed at the end of current block.
ATTENTION: This macro expands to two statements so following code is illegal:
Definition at line 136 of file sys_profiler.hh.