/* --sort typecln */
-/* TODO: use actual value in the system */
-#define TYPE_CACHELINE_SIZE 64
+#define DEFAULT_CACHELINE_SIZE 64
static int64_t
sort__typecln_sort(struct hist_entry *left, struct hist_entry *right)
struct annotated_data_type *right_type = right->mem_type;
int64_t left_cln, right_cln;
int64_t ret;
+ int cln_size = cacheline_size();
+
+ if (cln_size == 0)
+ cln_size = DEFAULT_CACHELINE_SIZE;
if (!left_type) {
sort__type_init(left);
if (ret)
return ret;
- left_cln = left->mem_type_off / TYPE_CACHELINE_SIZE;
- right_cln = right->mem_type_off / TYPE_CACHELINE_SIZE;
+ left_cln = left->mem_type_off / cln_size;
+ right_cln = right->mem_type_off / cln_size;
return left_cln - right_cln;
}
size_t size, unsigned int width __maybe_unused)
{
struct annotated_data_type *he_type = he->mem_type;
+ int cln_size = cacheline_size();
+
+ if (cln_size == 0)
+ cln_size = DEFAULT_CACHELINE_SIZE;
return repsep_snprintf(bf, size, "%s: cache-line %d", he_type->self.type_name,
- he->mem_type_off / TYPE_CACHELINE_SIZE);
+ he->mem_type_off / cln_size);
}
struct sort_entry sort_type_cacheline = {