Add verbose define

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
Micaela Verucchi
2020-05-15 09:41:27 +02:00
parent 5d01a3f629
commit 23b40de508
3 changed files with 9 additions and 7 deletions
+3 -3
View File
@@ -100,7 +100,7 @@ class DetectionNN {
if(save_times && times==nullptr)
FatalError("save_times set to true, but no valid ofstream given");
printCenteredTitle(" TENSORRT detection ", '=', 30);
if(VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30);
{
TIMER_START
for(int bi=0; bi<nBatches;++bi){
@@ -117,11 +117,11 @@ class DetectionNN {
tk::dnn::dataDim_t dim = netRT->input_dim;
dim.n = nBatches;
{
dim.print();
if(VERBOSE) dim.print();
TIMER_START
netRT->infer(dim, input_d);
TIMER_STOP
dim.print();
if(VERBOSE) dim.print();
stats.push_back(t_ns);
if(save_times) *times<<t_ns<<";";
}
+5 -3
View File
@@ -36,16 +36,18 @@
#define COL_PURPLEB "\033[1;35m"
#define COL_CYANB "\033[1;36m"
#define VERBOSE 0
// Simple Timer
#define TIMER_START timespec start, end; \
clock_gettime(CLOCK_MONOTONIC, &start);
#define TIMER_STOP_C(col) clock_gettime(CLOCK_MONOTONIC, &end); \
#define TIMER_STOP_C(col, show) clock_gettime(CLOCK_MONOTONIC, &end); \
double t_ns = ((double)(end.tv_sec - start.tv_sec) * 1.0e9 + \
(double)(end.tv_nsec - start.tv_nsec))/1.0e6; \
std::cout<<col<<"Time:"<<std::setw(16)<<t_ns<<" ms\n"<<COL_END;
if(show) std::cout<<col<<"Time:"<<std::setw(16)<<t_ns<<" ms\n"<<COL_END;
#define TIMER_STOP TIMER_STOP_C(COL_CYANB)
#define TIMER_STOP TIMER_STOP_C(COL_CYANB, VERBOSE)
/********************************************************
* Prints the error message, and exits