From 2701a364228d91ba2c52f511ad6619d070e2235b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 4 Jan 2025 01:59:26 -0600 Subject: Show checkpoints passed with -debug switch --- VERSION | 2 +- doc/code/pangemma.md | 14 ++++++++++++++ src/checkpoint.cpp | 3 ++- src/checkpoint.h | 6 ++++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 57c861a..8acdd82 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.98.5 +0.0.1 diff --git a/doc/code/pangemma.md b/doc/code/pangemma.md index d65245e..223e2ae 100644 --- a/doc/code/pangemma.md +++ b/doc/code/pangemma.md @@ -204,6 +204,20 @@ multiple outputs - in that case we may add filenames. And exits with: **** Checkpoint reached: read-geno-file (normal exit) ``` +# List check points + +When you compile PanGEMMA with debug information + +``` +make debug +``` + +and run a computation with the '-debug' switch it should output the check-points it passes. You should see something like + +``` +**** DEBUG: checkpoint read-geno-file passed with ./example/mouse_hs1940.geno.txt.gz in src/gemma_io.cpp at line 874 in ReadFile_geno +``` + # Other ## Example diff --git a/src/checkpoint.cpp b/src/checkpoint.cpp index 6fcc1a2..a37c1be 100644 --- a/src/checkpoint.cpp +++ b/src/checkpoint.cpp @@ -26,7 +26,8 @@ using namespace std; -void checkpoint(string msg, string filename) { +void checkpoint_run(string msg, string filename, string srcfilename, int line, string funcname) { + is_debug_mode() && std::cerr << "**** DEBUG: checkpoint " << msg << " passed with " << filename << " in " << srcfilename << " at line " << line << " in " << funcname << endl; if (msg == checkpoint_name) { cerr << "**** Checkpoint reached: " << msg << " (normal exit)" << endl; exit(0); diff --git a/src/checkpoint.h b/src/checkpoint.h index 7a70855..2792fac 100644 --- a/src/checkpoint.h +++ b/src/checkpoint.h @@ -20,12 +20,14 @@ #ifndef __CHECKPOINT_H__ #define __CHECKPOINT_H__ -#include +#include using namespace std; extern string checkpoint_name; -void checkpoint(string msg, string filename); +void checkpoint_run(string msg, string filename, string srcfilename, int line, string funcname); +#define checkpoint(msg, fname) \ + checkpoint_run(msg, fname, __FILE__, __LINE__, __SHOW_FUNC) #endif -- cgit v1.2.3