@@ -199,35 +199,20 @@ static int print_results_cache(char *filename, int bm_pid,
return 0;
}
-int measure_cache_vals(struct resctrl_val_param *param, int bm_pid)
+int measure_llc_resctrl(struct resctrl_val_param *param, int bm_pid)
{
- unsigned long llc_perf_miss = 0, llc_occu_resc = 0, llc_value = 0;
+ unsigned long llc_occu_resc = 0;
int ret;
- /*
- * Measure cache miss from perf.
- */
- if (!strncmp(param->resctrl_val, CAT_STR, sizeof(CAT_STR))) {
- ret = get_llc_perf(&llc_perf_miss);
- if (ret < 0)
- return ret;
- llc_value = llc_perf_miss;
- }
-
/*
* Measure llc occupancy from resctrl.
*/
- if (!strncmp(param->resctrl_val, CMT_STR, sizeof(CMT_STR))) {
- ret = get_llc_occu_resctrl(&llc_occu_resc);
- if (ret < 0)
- return ret;
- llc_value = llc_occu_resc;
- }
- ret = print_results_cache(param->filename, bm_pid, llc_value);
- if (ret)
+ ret = get_llc_occu_resctrl(&llc_occu_resc);
+ if (ret < 0)
return ret;
- return 0;
+ ret = print_results_cache(param->filename, bm_pid, llc_occu_resc);
+ return ret;
}
/*
@@ -241,6 +226,7 @@ int cat_val(struct resctrl_val_param *param)
{
int memflush = 1, operation = 0, ret = 0;
char *resctrl_val = param->resctrl_val;
+ unsigned long llc_perf_miss = 0;
pid_t bm_pid;
if (strcmp(param->filename, "") == 0)
@@ -281,7 +267,14 @@ int cat_val(struct resctrl_val_param *param)
}
sleep(1);
- ret = measure_cache_vals(param, bm_pid);
+
+ /* Measure cache miss from perf */
+ ret = get_llc_perf(&llc_perf_miss);
+ if (ret)
+ break;
+
+ ret = print_results_cache(param->filename, bm_pid,
+ llc_perf_miss);
if (ret)
break;
}
@@ -124,7 +124,7 @@ int cmt_resctrl_val(int cpu_no, int n, char **benchmark_cmd);
unsigned int count_bits(unsigned long n);
void cmt_test_cleanup(void);
int get_core_sibling(int cpu_no);
-int measure_cache_vals(struct resctrl_val_param *param, int bm_pid);
+int measure_llc_resctrl(struct resctrl_val_param *param, int bm_pid);
int show_cache_info(unsigned long sum_llc_val, int no_of_bits,
unsigned long cache_span, unsigned long max_diff,
unsigned long max_diff_percent, unsigned long num_of_runs,
@@ -774,7 +774,7 @@ int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param)
break;
} else if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
sleep(1);
- ret = measure_cache_vals(param, bm_pid);
+ ret = measure_llc_resctrl(param, bm_pid);
if (ret)
break;
}