@@ -265,6 +265,7 @@ struct FeatureEvictMetrics {
265
265
explicit FeatureEvictMetrics (int table_num) {
266
266
evicted_counts.resize (table_num, 0 );
267
267
processed_counts.resize (table_num, 0 );
268
+ eviction_threshold_with_dry_run.resize (table_num, 0.0 );
268
269
exec_duration_ms = 0 ;
269
270
full_duration_ms = 0 ;
270
271
dry_run_exec_duration_ms = 0 ;
@@ -273,6 +274,10 @@ struct FeatureEvictMetrics {
273
274
void reset () {
274
275
std::fill (evicted_counts.begin (), evicted_counts.end (), 0 );
275
276
std::fill (processed_counts.begin (), processed_counts.end (), 0 );
277
+ std::fill (
278
+ eviction_threshold_with_dry_run.begin (),
279
+ eviction_threshold_with_dry_run.end (),
280
+ 0.0 );
276
281
exec_duration_ms = 0 ;
277
282
full_duration_ms = 0 ;
278
283
dry_run_exec_duration_ms = 0 ;
@@ -296,6 +301,7 @@ struct FeatureEvictMetrics {
296
301
297
302
std::vector<int64_t > evicted_counts;
298
303
std::vector<int64_t > processed_counts;
304
+ std::vector<float > eviction_threshold_with_dry_run;
299
305
int64_t exec_duration_ms;
300
306
int64_t full_duration_ms;
301
307
int64_t dry_run_exec_duration_ms;
@@ -307,6 +313,7 @@ struct FeatureEvictMetricTensors {
307
313
explicit FeatureEvictMetricTensors (int64_t table_num)
308
314
: evicted_counts(at::zeros({table_num}, at::kLong )),
309
315
processed_counts(at::zeros({table_num}, at::kLong )),
316
+ eviction_threshold_with_dry_run(at::zeros({table_num}, at::kFloat )),
310
317
exec_duration_ms(at::scalar_tensor(0 , at::kLong )),
311
318
dry_run_exec_duration_ms(at::scalar_tensor(0 , at::kLong )),
312
319
full_duration_ms(at::scalar_tensor(0 , at::kLong )) {}
@@ -315,11 +322,14 @@ struct FeatureEvictMetricTensors {
315
322
FeatureEvictMetricTensors (
316
323
at::Tensor evicted,
317
324
at::Tensor processed,
325
+ at::Tensor eviction_threshold_with_dry_run,
318
326
at::Tensor exec_duration,
319
327
at::Tensor dry_run_exec_duration_ms,
320
328
at::Tensor full_duration)
321
329
: evicted_counts(std::move(evicted)),
322
330
processed_counts (std::move(processed)),
331
+ eviction_threshold_with_dry_run(
332
+ std::move (eviction_threshold_with_dry_run)),
323
333
exec_duration_ms(std::move(exec_duration)),
324
334
dry_run_exec_duration_ms(std::move(dry_run_exec_duration_ms)),
325
335
full_duration_ms(std::move(full_duration)) {}
@@ -328,6 +338,7 @@ struct FeatureEvictMetricTensors {
328
338
return FeatureEvictMetricTensors{
329
339
evicted_counts.clone (),
330
340
processed_counts.clone (),
341
+ eviction_threshold_with_dry_run.clone (),
331
342
exec_duration_ms.clone (),
332
343
dry_run_exec_duration_ms.clone (),
333
344
full_duration_ms.clone ()};
@@ -337,6 +348,8 @@ struct FeatureEvictMetricTensors {
337
348
at::Tensor evicted_counts;
338
349
// feature count before evict
339
350
at::Tensor processed_counts;
351
+ // feature evict threshold with dry run
352
+ at::Tensor eviction_threshold_with_dry_run;
340
353
// feature evict exec duration
341
354
at::Tensor exec_duration_ms;
342
355
// feature evict dry run exec duration
@@ -893,6 +906,14 @@ class FeatureEvict {
893
906
at::kLong )
894
907
.clone ();
895
908
909
+ metric_tensors_.eviction_threshold_with_dry_run =
910
+ at::from_blob (
911
+ const_cast <float *>(metrics_.eviction_threshold_with_dry_run .data ()),
912
+ {static_cast <int64_t >(
913
+ metrics_.eviction_threshold_with_dry_run .size ())},
914
+ at::kFloat )
915
+ .clone ();
916
+
896
917
metric_tensors_.full_duration_ms =
897
918
at::scalar_tensor (metrics_.full_duration_ms , at::kLong );
898
919
metric_tensors_.exec_duration_ms =
@@ -913,14 +934,16 @@ class FeatureEvict {
913
934
" - dryrun Time taken: {}ms\n "
914
935
" - Total blocks processed: [{}]\n "
915
936
" - Blocks evicted: [{}]\n "
916
- " - Eviction rate: [{}]%\n " ,
937
+ " - Eviction rate: [{}]%\n "
938
+ " - Eviction threshold dry run: [{}]\n " ,
917
939
metrics_.full_duration_ms ,
918
940
metrics_.exec_duration_ms ,
919
941
metrics_.exec_duration_ms * 100 .0f / metrics_.full_duration_ms ,
920
942
metrics_.dry_run_exec_duration_ms ,
921
943
fmt::join (metrics_.processed_counts , " , " ),
922
944
fmt::join (metrics_.evicted_counts , " , " ),
923
- fmt::join (evict_rates, " , " ));
945
+ fmt::join (evict_rates, " , " ),
946
+ fmt::join (metrics_.eviction_threshold_with_dry_run , " , " ));
924
947
}
925
948
926
949
// Thread pool.
@@ -1320,6 +1343,11 @@ class FeatureScoreBasedEvict : public FeatureEvict<weight_type> {
1320
1343
std::chrono::high_resolution_clock::now ().time_since_epoch ())
1321
1344
.count ();
1322
1345
}
1346
+
1347
+ for (int table_id = 0 ; table_id < num_tables_; ++table_id) {
1348
+ this ->metrics_ .eviction_threshold_with_dry_run [table_id] =
1349
+ thresholds_[table_id];
1350
+ }
1323
1351
}
1324
1352
1325
1353
private:
0 commit comments