sgs_Stat [function]
ptrdiff_t sgs_Stat( sgs_Context* C, int type )
Returns or prints information about state of SGScript VM.
- The following
type
values are supported:
- SGS_STAT_VERSION: returns the version number of the VM;
- SGS_STAT_STATECOUNT: returns the number of execution states created in the VM;
- SGS_STAT_OBJCOUNT: returns the number of objects created in the VM;
- SGS_STAT_MEMSIZE: returns the number of bytes allocated through this SGScript context;
- SGS_STAT_NUMALLOCS: returns the number of memory allocations (incremented on each alloc/realloc);
- SGS_STAT_NUMFREES: returns the number of memory frees (incremented on each free/realloc);
- SGS_STAT_NUMBLOCKS: number of memory blocks currently allocated (incremented on alloc, decremented on free);
- SGS_STAT_DUMP_STACK: prints all of the variables in the stack;
- SGS_STAT_DUMP_GLOBALS: prints all variables in the global dictionary;
- SGS_STAT_DUMP_OBJECTS: prints all objects in the context;
- SGS_STAT_DUMP_FRAMES: prints all functions in the call stack;
- SGS_STAT_DUMP_STATS: dump some info about memory and objects;
- SGS_STAT_DUMP_SYMBOLS: dump the list of registered symbols;
- SGS_STAT_XDUMP_STACK: verbosely dumps all of the variables in the stack (extended info, may be much longer).
- Tips:
- compare return value of SGS_STAT_VERSION against SGS_VERSION_INT if using multiple versions should be supported / prevented.