@@ -108,8 +108,9 @@ static void setup_signal_handlers(void) {
108
108
assert (sigaction (SIGUSR2, &sa, NULL ) == 0 );
109
109
110
110
111
- if (getenv (" YUKON_DUMP" ) == NULL ) {
112
- int dump_interval_ms = 10 ;
111
+ if (getenv (" YUKON_DUMP" ) != NULL ) {
112
+ int dump_interval_ms = atoi (getenv (" YUKON_DUMP" ));
113
+
113
114
useconds_t dump_interval = dump_interval_ms * 1000 ;
114
115
signal (SIGALRM, alarm_handler);
115
116
// now that we have sigalarm configured, setup a ualarm for
@@ -159,16 +160,22 @@ namespace yukon {
159
160
void dump_htlb (alaska::ThreadCache *tc) {
160
161
auto size = 576 ;
161
162
auto *space = tc->localizer .get_hotness_buffer (size);
162
- memset (space, 0 , size * sizeof (alaska::handle_id_t ));
163
-
163
+ // memset(space, 0, size * sizeof(alaska::handle_id_t));
164
+ // Fence after we have a valid space for the dump
164
165
asm volatile (" fence" ::: " memory" );
165
166
166
167
auto start = read_cycle_counter ();
168
+
169
+ // Fire off the dump..
167
170
write_csr (CSR_HTDUMP, (uint64_t )space);
171
+ // ..and wait for it to finish
168
172
wait_for_csr_zero (CSR_HTDUMP);
169
173
auto end = read_cycle_counter ();
174
+ // fence so we have ordering
170
175
asm volatile (" fence" ::: " memory" );
176
+ // Feed the buffer to the localizer to do it's work
171
177
tc->localizer .feed_hotness_buffer (size, space);
178
+ // Fence again... for some reason
172
179
asm volatile (" fence" ::: " memory" );
173
180
// printf("Dumping htlb took %lu cycles\n", end - start);
174
181
}
@@ -235,11 +242,9 @@ void __attribute__((constructor(102))) alaska_init(void) {
235
242
unsetenv (" LD_PRELOAD" ); // make it so we don't run alaska in subprocesses!
236
243
yukon::get_tc ();
237
244
238
- atexit ([]() {
239
- printf (" Setting ht addr to zero!\n " );
240
- yukon::set_handle_table_base (NULL );
241
- printf (" set!\n " );
242
- });
245
+ // atexit([]() {
246
+ // yukon::set_handle_table_base(NULL);
247
+ // });
243
248
}
244
249
245
250
void __attribute__ ((destructor)) alaska_deinit(void ) {}
0 commit comments