urbit/i/n/t.h

115 lines
2.3 KiB
C
Raw Normal View History

2014-11-08 01:54:59 +03:00
/* i/n/t.h
2014-09-04 07:44:53 +04:00
**
** This file is in the public domain.
*/
2014-12-03 00:53:35 +03:00
/** Options.
**/
/* U3_CPU_DEBUG: activate profiling.
*/
# define U3_CPU_DEBUG
/** Data structures.
**/
/* u3t_trace: fast execution flags.
*/
typedef struct _u3t_trace {
c3_o noc_o; // now executing in nock interpreter
c3_o glu_o; // now executing in jet glue
c3_o mal_o; // now executing in allocator
2015-01-15 22:10:29 +03:00
c3_o far_o; // now executing in fragmentor
c3_o coy_o; // now executing in copy
c3_o euq_o; // now executing in equal
2014-12-03 00:53:35 +03:00
} u3t_trace;
/** Macros.
**/
2014-12-03 03:26:30 +03:00
# ifdef U3_CPU_DEBUG
# define u3t_on(var) \
2014-12-03 00:53:35 +03:00
(u3T.var = (u3C.wag_w & u3o_debug_cpu) \
2014-12-03 03:26:30 +03:00
? (c3n == u3T.var) ? c3y : (abort(), 0) \
2014-12-03 00:53:35 +03:00
: u3T.var)
2014-12-03 03:26:30 +03:00
# else
# define u3t_on(var)
#endif
2014-12-03 00:53:35 +03:00
2014-12-03 03:26:30 +03:00
# ifdef U3_CPU_DEBUG
# define u3t_off(var) \
2014-12-03 00:53:35 +03:00
(u3T.var = (u3C.wag_w & u3o_debug_cpu) \
2014-12-03 03:26:30 +03:00
? (c3y == u3T.var) ? c3n : (abort(), 0) \
2014-12-03 00:53:35 +03:00
: u3T.var)
2014-12-03 03:26:30 +03:00
# else
# define u3t_off(var)
#endif
2014-12-03 00:53:35 +03:00
2014-11-08 01:54:59 +03:00
/** Functions.
**/
2014-12-03 03:26:30 +03:00
/* u3t_init(): initialize tracing layer.
*/
void
u3t_init(void);
2014-11-08 01:54:59 +03:00
/* u3t_push(): push on trace stack.
*/
void
u3t_push(u3_noun mon);
/* u3t_mean(): push `[%mean roc]` on trace stack.
*/
void
u3t_mean(u3_noun roc);
/* u3t_drop(): drop from meaning stack.
*/
void
u3t_drop(void);
/* u3t_slog(): print directly.
*/
void
u3t_slog(u3_noun hod);
/* u3t_heck(): profile point.
*/
void
u3t_heck(u3_atom cog);
/* u3t_samp(): sample.
*/
void
u3t_samp(void);
2014-11-29 05:19:11 +03:00
/* u3t_come(): push on profile stack; return yes if active push. RETAIN.
2014-11-08 01:54:59 +03:00
*/
2014-11-29 05:19:11 +03:00
c3_o
u3t_come(u3_noun bat);
2014-11-08 01:54:59 +03:00
/* u3t_flee(): pop off profile stack.
*/
void
u3t_flee(void);
/* u3t_damp(): print and clear profile data.
*/
void
u3t_damp(void);
/* u3t_boff(): turn profile sampling off.
*/
void
u3t_boff(void);
/* u3t_boot(): turn sampling on.
*/
void
u3t_boot(void);
2014-12-03 00:53:35 +03:00
/** Globals.
**/
/* u3_Trace / u3C: global memory control.
*/
c3_global u3t_trace u3t_Trace;
# define u3T u3t_Trace