/*
 * cputime.h --
 *
 *      Header for the cpuTime functions: tools to measure cpu usage
 *      of different parts of code.
 * 
 * Copyright (c) 2016-2017 by Simon Bachmann <simonbachmann@bluewin.ch>
 * All rights reserved.
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 * 
 */

#ifndef IMGTOOLS_CPUTIME_H
    #define IMGTOOLS_CPUTIME_H
    
    int Cputime_SetScopes_L (Tcl_Interp * interp, const char * const* names);
    int Cputime_NewScope_L (Tcl_Interp * interp, int scopeIndex);
    int Cputime_EndScope_L (Tcl_Interp * interp);
    int Cputime_EndScopeSecure_L (Tcl_Interp * interp, int scopeIndex);
    int Cputime_PrintSummary_L (Tcl_Interp * interp);
    void Cputime_Cleanup_L (Tcl_Interp * interp);


    #ifdef IMGTOOLS_DEBUG
        //#define CPUTIME
        //#include <time.h>
    
        #define Cputime_SetScopes(INTERP, NAMES) Cputime_SetScopes_L ( (INTERP) , (NAMES) )
        #define Cputime_NewScope(INTERP, INDEX) Cputime_NewScope_L ( (INTERP) , (INDEX) )
        #define Cputime_EndScopeSecure(INTERP, INDEX) Cputime_EndScopeSecure_L ( (INTERP) , (INDEX) )
        #define Cputime_PrintSummary(INTERP) Cputime_PrintSummary_L ( (INTERP) )
        #define Cputime_Cleanup(INTERP) Cputime_Cleanup_L ( (INTERP) )
    #else
        #define Cputime_SetScopes(INTERP, NAMES) ((void)0)
        #define Cputime_NewScope(INTERP, INDEX_START) ((void)0)
        #define Cputime_EndScopeSecure(INTERP, INDEX_END) ((void)0)
        #define Cputime_PrintSummary(INTERP) ((void)0)
        #define Cputime_Cleanup(INTERP) ((void)0)
    #endif
#endif
