aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Kistruck2006-12-11 15:39:58 +0000
committerRichard Kistruck2006-12-11 15:39:58 +0000
commit0a9f08cef4625ef9aa446de426b3e010ce892ff5 (patch)
tree1d60cd5f8f4c2be4f1ab271292445585313cd52d /mps/code
parentb924a4812a1d71011b0a65015173cbfbaeb5f35b (diff)
downloademacs-0a9f08cef4625ef9aa446de426b3e010ce892ff5.tar.gz
emacs-0a9f08cef4625ef9aa446de426b3e010ce892ff5.zip
Mps: amsss (ams stress-test): enable and report mps_message_type_gc and _gc_start
Copied from Perforce Change: 161193 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/amsss.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/mps/code/amsss.c b/mps/code/amsss.c
index 9c878a1934a..513056f2d2c 100644
--- a/mps/code/amsss.c
+++ b/mps/code/amsss.c
@@ -44,6 +44,50 @@ static mps_addr_t ambigRoots[ambigRootsCOUNT];
44static size_t totalSize = 0; 44static size_t totalSize = 0;
45 45
46 46
47/* report - report statistics from any messages */
48
49static void report()
50{
51 static int nStart = 0;
52 static int nComplete = 0;
53 mps_message_type_t type;
54
55 while(mps_message_queue_type(&type, arena)) {
56 mps_message_t message;
57
58 cdie(mps_message_get(&message, arena, type), "message get");
59
60 switch(type) {
61 /* @@@@ is using these macros in a switch supported? */
62 case mps_message_type_gc_start():
63 printf("\nCollection start %d. Because:\n", ++nStart);
64 printf("%s\n", mps_message_gc_start_why(arena, message));
65
66 break;
67 case mps_message_type_gc():
68 {
69 size_t live, condemned, not_condemned;
70
71 live = mps_message_gc_live_size(arena, message);
72 condemned = mps_message_gc_condemned_size(arena, message);
73 not_condemned = mps_message_gc_not_condemned_size(arena, message);
74
75 printf("\nCollection complete %d:\n", ++nComplete);
76 printf("live %lu\n", (unsigned long)live);
77 printf("condemned %lu\n", (unsigned long)condemned);
78 printf("not_condemned %lu\n", (unsigned long)not_condemned);
79 }
80 break;
81 default:
82 cdie(0, "unknown message type");
83 }
84 mps_message_discard(arena, message);
85 }
86
87 return;
88}
89
90
47/* make -- object allocation and init */ 91/* make -- object allocation and init */
48 92
49static mps_addr_t make(void) 93static mps_addr_t make(void)
@@ -142,6 +186,7 @@ static void *test(void *arg, size_t haveAmbigous)
142 ++objs; 186 ++objs;
143 if (objs % 256 == 0) { 187 if (objs % 256 == 0) {
144 printf("."); 188 printf(".");
189 report();
145 fflush(stdout); 190 fflush(stdout);
146 } 191 }
147 } 192 }
@@ -169,31 +214,33 @@ int main(int argc, char **argv)
169 214
170 die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), 215 die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
171 "arena_create"); 216 "arena_create");
217 mps_message_type_enable(arena, mps_message_type_gc_start());
218 mps_message_type_enable(arena, mps_message_type_gc());
172 die(mps_thread_reg(&thread, arena), "thread_reg"); 219 die(mps_thread_reg(&thread, arena), "thread_reg");
173 die(mps_fmt_create_A(&format, arena, dylan_fmt_A()), "fmt_create"); 220 die(mps_fmt_create_A(&format, arena, dylan_fmt_A()), "fmt_create");
174 die(mps_chain_create(&chain, arena, 1, testChain), "chain_create"); 221 die(mps_chain_create(&chain, arena, 1, testChain), "chain_create");
175 222
176 printf("\nAMS Debug\n"); 223 printf("\n\n****************************** Testing AMS Debug\n");
177 die(mps_pool_create(&pool, arena, mps_class_ams_debug(), &freecheckOptions, 224 die(mps_pool_create(&pool, arena, mps_class_ams_debug(), &freecheckOptions,
178 format, chain, FALSE), 225 format, chain, FALSE),
179 "pool_create(ams_debug,share)"); 226 "pool_create(ams_debug,share)");
180 mps_tramp(&r, test, pool, 0); 227 mps_tramp(&r, test, pool, 0);
181 mps_pool_destroy(pool); 228 mps_pool_destroy(pool);
182 229
183 printf("\nAMS Debug\n"); 230 printf("\n\n****************************** Testing AMS Debug\n");
184 die(mps_pool_create(&pool, arena, mps_class_ams_debug(), &freecheckOptions, 231 die(mps_pool_create(&pool, arena, mps_class_ams_debug(), &freecheckOptions,
185 format, chain, TRUE), 232 format, chain, TRUE),
186 "pool_create(ams_debug,ambig)"); 233 "pool_create(ams_debug,ambig)");
187 mps_tramp(&r, test, pool, 1); 234 mps_tramp(&r, test, pool, 1);
188 mps_pool_destroy(pool); 235 mps_pool_destroy(pool);
189 236
190 printf("\nAMS\n"); 237 printf("\n\n****************************** Testing AMS\n");
191 die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, TRUE), 238 die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, TRUE),
192 "pool_create(ams,ambig)"); 239 "pool_create(ams,ambig)");
193 mps_tramp(&r, test, pool, 1); 240 mps_tramp(&r, test, pool, 1);
194 mps_pool_destroy(pool); 241 mps_pool_destroy(pool);
195 242
196 printf("\nAMS\n"); 243 printf("\n\n****************************** Testing AMS\n");
197 die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, FALSE), 244 die(mps_pool_create(&pool, arena, mps_class_ams(), format, chain, FALSE),
198 "pool_create(ams,share)"); 245 "pool_create(ams,share)");
199 mps_tramp(&r, test, pool, 0); 246 mps_tramp(&r, test, pool, 0);