 |
Belle II Software
release-05-02-19
|
19 template<
class... Ts>
struct VisitOverload : Ts... {
using Ts::operator()...; };
28 T
reduceTBranch(TBranch* branch,
const std::function<T(T, T)>& f, T reduced = T())
31 branch->SetAddress(&
object);
32 int nevents = branch->GetEntries();
33 for (
int i = 0; i < nevents; ++i) {
35 reduced = f(reduced,
object);
75 explicit Timer(std::string text =
"");
85 std::string
getCommandOutput(
const std::string& command,
const std::vector<std::string>& arguments = {},
bool searchPath =
true);
95 #define B2INFO_MEASURE_TIME(txt, ...) {\
96 std::stringstream __b2_timer_str__;\
97 __b2_timer_str__ << txt;\
98 ::Belle2::Utils::Timer __b2_timer__(__b2_timer_str__.str());\
143 #if defined(__GNUC__) || defined(__ICL) || defined(__clang__)
144 #define branch_likely(x) __builtin_expect(!!(x), 1)
145 #define branch_unlikely(x) __builtin_expect(!!(x), 0)
147 #define branch_likely(x) (x)
148 #define branch_unlikely(x) (x)
unsigned long getRssMemoryKB()
Returns the amount of memory the process actually occupies in the physical RAM of the machine.
Helper struct for the C++17 std::visit overload pattern to allow simple use of variants.
VisitOverload(Ts...) -> VisitOverload< Ts... >
Function for the C++17 std::visit overload pattern to allow simple use of variants.
Timer(std::string text="")
Constructor, with some identifying text.
double getCPUClock()
Return current value of the per-thread CPU clock.
std::string getCommandOutput(const std::string &command, const std::vector< std::string > &arguments={}, bool searchPath=true)
Execute a shell command and return its output.
T reduceTBranch(TBranch *branch, const std::function< T(T, T)> &f, T reduced=T())
Reduce a branch of a TTree.
Small helper class that prints its lifetime when destroyed.
Abstract base class for different kinds of events.
double m_startTime
time at start (in ns).
double getClock()
Return current value of the real-time clock.
unsigned long getVirtualMemoryKB()
Returns currently used virtual memory in KB, includes swapped and not occupied memory pages and memor...
std::string m_text
identifying text (printed at end).