MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / get_min_distance

Function get_min_distance

libCacheSim/dataStructure/histogram.c:87–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87uint64_t get_min_distance(ReuseHistogram* hist) {
88 if (!hist || g_hash_table_size(hist->bins) == 0) {
89 return UINT64_MAX; // Return max value if histogram is empty
90 }
91
92 GHashTableIter iter;
93 gpointer key, value;
94 uint64_t min_distance = UINT64_MAX;
95
96 g_hash_table_iter_init(&iter, hist->bins);
97 while (g_hash_table_iter_next(&iter, &key, &value)) {
98 uint64_t distance = *(uint64_t*)key;
99 if (distance < min_distance) {
100 min_distance = distance;
101 }
102 }
103
104 return min_distance;
105}
106
107void free_histogram(ReuseHistogram* hist) {
108 GHashTableIter iter;

Callers 1

adjust_histogramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected