Skip to content

Commit

Permalink
Move profiling accessors from calls.h to calls.c
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored and ChrisJefferson committed Dec 1, 2017
1 parent c98c5f0 commit 29b748c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
56 changes: 56 additions & 0 deletions src/calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,62 @@ Char * NAMI_FUNC(Obj func, Int i)
}


/****************************************************************************
**
*F COUNT_PROF( <prof> ) . . . . . . . . number of invocations of a function
*F TIME_WITH_PROF( <prof> ) . . . . . . time with children in a function
*F TIME_WOUT_PROF( <prof> ) . . . . . . time without children in a function
*F STOR_WITH_PROF( <prof> ) . . . . storage with children in a function
*F STOR_WOUT_PROF( <prof> ) . . . . storage without children in a function
*V LEN_PROF . . . . . . . . . . . length of a profiling bag for a function
**
** With each function we associate two time measurements. First the *time
** spent by this function without its children*, i.e., the amount of time
** during which this function was active. Second the *time spent by this
** function with its children*, i.e., the amount of time during which this
** function was either active or suspended.
**
** Likewise with each function we associate the two storage measurements,
** the storage spent by this function without its children and the storage
** spent by this function with its children.
**
** These macros make it possible to access the various components of a
** profiling information bag <prof> for a function <func>.
**
** 'COUNT_PROF(<prof>)' is the number of calls to the function <func>.
** 'TIME_WITH_PROF(<prof>) is the time spent while the function <func> was
** either active or suspended. 'TIME_WOUT_PROF(<prof>)' is the time spent
** while the function <func> was active. 'STOR_WITH_PROF(<prof>)' is the
** amount of storage allocated while the function <func> was active or
** suspended. 'STOR_WOUT_PROF(<prof>)' is the amount of storage allocated
** while the function <func> was active. 'LEN_PROF' is the length of a
** profiling information bag.
*/
#define COUNT_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,1)))
#define TIME_WITH_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,2)))
#define TIME_WOUT_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,3)))
#define STOR_WITH_PROF(prof) (UInt8_ObjInt(ELM_PLIST(prof,4)))
#define STOR_WOUT_PROF(prof) (UInt8_ObjInt(ELM_PLIST(prof,5)))

#define SET_COUNT_PROF(prof,n) SET_ELM_PLIST(prof,1,INTOBJ_INT(n))
#define SET_TIME_WITH_PROF(prof,n) SET_ELM_PLIST(prof,2,INTOBJ_INT(n))
#define SET_TIME_WOUT_PROF(prof,n) SET_ELM_PLIST(prof,3,INTOBJ_INT(n))

static inline void SET_STOR_WITH_PROF(Obj prof, UInt8 n)
{
SET_ELM_PLIST(prof,4,ObjInt_Int8(n));
CHANGED_BAG(prof);
}

static inline void SET_STOR_WOUT_PROF(Obj prof, UInt8 n)
{
SET_ELM_PLIST(prof,5,ObjInt_Int8(n));
CHANGED_BAG(prof);
}

#define LEN_PROF 5


/****************************************************************************
**
*F * * * * wrapper for functions with variable number of arguments * * * * *
Expand Down
56 changes: 0 additions & 56 deletions src/calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,62 +345,6 @@ extern Obj NargError(Obj func, Int actual);
HDLR_XARGS(PROF_FUNC(f))(f,as)


/****************************************************************************
**
*F COUNT_PROF( <prof> ) . . . . . . . . number of invocations of a function
*F TIME_WITH_PROF( <prof> ) . . . . . . time with children in a function
*F TIME_WOUT_PROF( <prof> ) . . . . . . time without children in a function
*F STOR_WITH_PROF( <prof> ) . . . . storage with children in a function
*F STOR_WOUT_PROF( <prof> ) . . . . storage without children in a function
*V LEN_PROF . . . . . . . . . . . length of a profiling bag for a function
**
** With each function we associate two time measurements. First the *time
** spent by this function without its children*, i.e., the amount of time
** during which this function was active. Second the *time spent by this
** function with its children*, i.e., the amount of time during which this
** function was either active or suspended.
**
** Likewise with each function we associate the two storage measurements,
** the storage spent by this function without its children and the storage
** spent by this function with its children.
**
** These macros make it possible to access the various components of a
** profiling information bag <prof> for a function <func>.
**
** 'COUNT_PROF(<prof>)' is the number of calls to the function <func>.
** 'TIME_WITH_PROF(<prof>) is the time spent while the function <func> was
** either active or suspended. 'TIME_WOUT_PROF(<prof>)' is the time spent
** while the function <func> was active. 'STOR_WITH_PROF(<prof>)' is the
** amount of storage allocated while the function <func> was active or
** suspended. 'STOR_WOUT_PROF(<prof>)' is the amount of storage allocated
** while the function <func> was active. 'LEN_PROF' is the length of a
** profiling information bag.
*/
#define COUNT_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,1)))
#define TIME_WITH_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,2)))
#define TIME_WOUT_PROF(prof) (INT_INTOBJ(ELM_PLIST(prof,3)))
#define STOR_WITH_PROF(prof) (UInt8_ObjInt(ELM_PLIST(prof,4)))
#define STOR_WOUT_PROF(prof) (UInt8_ObjInt(ELM_PLIST(prof,5)))

#define SET_COUNT_PROF(prof,n) SET_ELM_PLIST(prof,1,INTOBJ_INT(n))
#define SET_TIME_WITH_PROF(prof,n) SET_ELM_PLIST(prof,2,INTOBJ_INT(n))
#define SET_TIME_WOUT_PROF(prof,n) SET_ELM_PLIST(prof,3,INTOBJ_INT(n))

static inline void SET_STOR_WITH_PROF(Obj prof, UInt8 n)
{
SET_ELM_PLIST(prof,4,ObjInt_Int8(n));
CHANGED_BAG(prof);
}

static inline void SET_STOR_WOUT_PROF(Obj prof, UInt8 n)
{
SET_ELM_PLIST(prof,5,ObjInt_Int8(n));
CHANGED_BAG(prof);
}

#define LEN_PROF 5


/****************************************************************************
**
*F FuncFILENAME_FUNC(Obj self, Obj func) . . . . . . . filename of function
Expand Down

0 comments on commit 29b748c

Please sign in to comment.