aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code/amcss.c
diff options
context:
space:
mode:
authorRichard Kistruck2008-11-12 15:07:04 +0000
committerRichard Kistruck2008-11-12 15:07:04 +0000
commita563a7620470af7fbb079f3d05a12ece141ff86f (patch)
tree0f29d3e1f26a01607701263600503b8ed39f86fe /mps/code/amcss.c
parent08fb5a0526c2d6b823505b59d0cc6f6487d972b8 (diff)
downloademacs-a563a7620470af7fbb079f3d05a12ece141ff86f.tar.gz
emacs-a563a7620470af7fbb079f3d05a12ece141ff86f.zip
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
Diffstat (limited to 'mps/code/amcss.c')
-rw-r--r--mps/code/amcss.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/mps/code/amcss.c b/mps/code/amcss.c
index 647d0525fc4..8b88dd38bec 100644
--- a/mps/code/amcss.c
+++ b/mps/code/amcss.c
@@ -47,7 +47,27 @@ static mps_addr_t exactRoots[exactRootsCOUNT];
47static mps_addr_t ambigRoots[ambigRootsCOUNT]; 47static mps_addr_t ambigRoots[ambigRootsCOUNT];
48 48
49 49
50/* report - report statistics from any messages */ 50/* alert -- synchronous alert of collection start/stop */
51
52static void alertfn(int alertcode, int whycode)
53{
54 switch(alertcode) {
55 case MPS_ALERT_COLLECTION_START: {
56 printf("\n^^^^^^ START (why: %d) ^^^^^^\n", whycode);
57 break;
58 }
59 case MPS_ALERT_COLLECTION_STOP: {
60 printf("vvvvvv STOP (why: %d) vvvvvv\n", whycode);
61 break;
62 }
63 default: {
64 cdie(0, "unknown alertcode");
65 break;
66 }
67 }
68}
69
70/* report -- report statistics from any messages */
51 71
52static void report(mps_arena_t arena) 72static void report(mps_arena_t arena)
53{ 73{
@@ -313,6 +333,7 @@ int main(int argc, char **argv)
313 "arena_create"); 333 "arena_create");
314 mps_message_type_enable(arena, mps_message_type_gc()); 334 mps_message_type_enable(arena, mps_message_type_gc());
315 mps_message_type_enable(arena, mps_message_type_gc_start()); 335 mps_message_type_enable(arena, mps_message_type_gc_start());
336 mps_alert_collection_set(arena, &alertfn);
316 die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit"); 337 die(mps_arena_commit_limit_set(arena, testArenaSIZE), "set limit");
317 die(mps_thread_reg(&thread, arena), "thread_reg"); 338 die(mps_thread_reg(&thread, arena), "thread_reg");
318 mps_tramp(&r, test, arena, 0); 339 mps_tramp(&r, test, arena, 0);