MaCh3  2.2.3
Reference Guide
Monitor.h
Go to the documentation of this file.
1 #pragma once
2 
3 // C++ includes
4 #include <iostream>
5 #include <fstream>
6 #include <string>
7 #include <vector>
8 #include <cstdlib>
9 
10 // MaCh3 includes
11 #include "Manager/MaCh3Logger.h"
12 #include "Manager/MaCh3Exception.h"
13 #include "Manager/YamlHelper.h"
14 
16 // ROOT include
17 #include "TTree.h"
18 #include "TBranch.h"
19 #include "TMacro.h"
20 #include "TChain.h"
21 #include "TStopwatch.h"
23 
24 
28 
29 namespace MaCh3Utils {
31  void MaCh3Welcome();
33  void GetOSInfo();
35  void GetCPUInfo();
37  void GetGPUInfo();
39  void NThreadsSanity();
43  std::string TerminalToString(std::string cmd);
45  void EstimateDataTransferRate(TChain* chain, const Long64_t entry);
47  void GetDiskUsage();
52  void PrintProgressBar(const Long64_t Done, const Long64_t All);
56  std::string GetMaCh3Version();
61  int getValue(const std::string& Type);
66  int parseLine(const std::string& line);
69  void PrintConfig(const YAML::Node& node);
71  void Print(const TTree* tree);
76  void MaCh3Usage(int argc, char **argv);
77 }
78 
79 namespace M3 {
81  int GetNThreads();
84  void AddPath(std::string& FilePath);
86  inline int GetThreadIndex() {
87  #ifdef MULTITHREAD
88  return omp_get_thread_num();
89  #else
90  return 0;
91  #endif
92  }
93 }
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
Definition: Core.h:109
#define _MaCh3_Safe_Include_End_
KS: Restore warning checking after including external headers.
Definition: Core.h:120
KS: Based on this https://github.com/gabime/spdlog/blob/a2b4262090fd3f005c2315dcb5be2f0f1774a005/incl...
Utility functions for handling YAML nodes.
Definition: Core.h:19
int GetThreadIndex()
thread index inside parallel loop
Definition: Monitor.h:86
int GetNThreads()
number of threads which we need for example for TRandom3
Definition: Monitor.cpp:357
void AddPath(std::string &FilePath)
Prepends the MACH3 environment path to FilePath if it is not already present.
Definition: Monitor.cpp:367
void GetOSInfo()
KS: Find out more about operational system.
Definition: Monitor.cpp:88
std::string TerminalToString(std::string cmd)
KS: Convoluted code to grab output from terminal to string.
Definition: Monitor.cpp:178
void PrintProgressBar(const Long64_t Done, const Long64_t All)
KS: Simply print progress bar.
Definition: Monitor.cpp:213
std::string GetMaCh3Version()
KS: Get version of MaCh3.
Definition: Monitor.cpp:46
void Print(const TTree *tree)
Definition: Monitor.cpp:310
void GetDiskUsage()
KS: Find out about Disk usage.
Definition: Monitor.cpp:168
void NThreadsSanity()
KS: Check if user is not using huge number of threads and throw error.
Definition: Monitor.cpp:122
void GetCPUInfo()
KS: Check what CPU you are using.
Definition: Monitor.cpp:99
void GetGPUInfo()
KS: Check what GPU you are using.
Definition: Monitor.cpp:143
int getValue(const std::string &Type)
CW: Get info like RAM.
Definition: Monitor.cpp:236
void PrintConfig(const YAML::Node &node)
KS: Print Yaml config using logger.
Definition: Monitor.cpp:295
void MaCh3Usage(int argc, char **argv)
KS: Almost all MaCh3 executables have the same usage, prepare simple printer.
Definition: Monitor.cpp:344
void MaCh3Welcome()
KS: Prints welcome message with MaCh3 logo.
Definition: Monitor.cpp:12
int parseLine(const std::string &line)
CW: Get memory, which is probably silly.
Definition: Monitor.cpp:285
void EstimateDataTransferRate(TChain *chain, const Long64_t entry)
KS: Check what CPU you are using.
Definition: Monitor.cpp:196