mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 22:20:24 -08:00
Mps br/timing: mps_alert_collection_set() -- client sets a callback
function; MPS calls it synchronously on collection start/stop (immediately after posting start/stop message). The callback receives two ints: alertcode (start|stop; see mps.h), and whycode (trace->why). Note: callback is also called for heap walk start/stop. amcss.c: show start/stop alerts. Copied from Perforce Change: 166703 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
08fb5a0526
commit
a563a76204
6 changed files with 61 additions and 1 deletions
|
|
@ -47,7 +47,27 @@ static mps_addr_t exactRoots[exactRootsCOUNT];
|
|||
static mps_addr_t ambigRoots[ambigRootsCOUNT];
|
||||
|
||||
|
||||
/* report - report statistics from any messages */
|
||||
/* alert -- synchronous alert of collection start/stop */
|
||||
|
||||
static void alertfn(int alertcode, int whycode)
|
||||
{
|
||||
switch(alertcode) {
|
||||
case MPS_ALERT_COLLECTION_START: {
|
||||
printf("\n^^^^^^ START (why: %d) ^^^^^^\n", whycode);
|
||||
break;
|
||||
}
|
||||
case MPS_ALERT_COLLECTION_STOP: {
|
||||
printf("vvvvvv STOP (why: %d) vvvvvv\n", whycode);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
cdie(0, "unknown alertcode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* report -- report statistics from any messages */
|
||||
|
||||
static void report(mps_arena_t arena)
|
||||
{
|
||||
|
|
@ -313,6 +333,7 @@ int main(int argc, char **argv)
|
|||
"arena_create");
|
||||
mps_message_type_enable(arena, mps_message_type_gc());
|
||||
mps_message_type_enable(arena, mps_message_type_gc_start());
|
||||
mps_alert_collection_set(arena, &alertfn);
|
||||
die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit");
|
||||
die(mps_thread_reg(&thread, arena), "thread_reg");
|
||||
mps_tramp(&r, test, arena, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue