0001
0002 #include <linux/types.h>
0003 #include <linux/string.h>
0004 #include <linux/zalloc.h>
0005
0006 #include "../../../util/event.h"
0007 #include "../../../util/synthetic-events.h"
0008 #include "../../../util/machine.h"
0009 #include "../../../util/tool.h"
0010 #include "../../../util/map.h"
0011 #include "../../../util/debug.h"
0012
0013 void arch_perf_parse_sample_weight(struct perf_sample *data,
0014 const __u64 *array, u64 type)
0015 {
0016 union perf_sample_weight weight;
0017
0018 weight.full = *array;
0019 if (type & PERF_SAMPLE_WEIGHT)
0020 data->weight = weight.full;
0021 else {
0022 data->weight = weight.var1_dw;
0023 data->ins_lat = weight.var2_w;
0024 data->p_stage_cyc = weight.var3_w;
0025 }
0026 }
0027
0028 void arch_perf_synthesize_sample_weight(const struct perf_sample *data,
0029 __u64 *array, u64 type)
0030 {
0031 *array = data->weight;
0032
0033 if (type & PERF_SAMPLE_WEIGHT_STRUCT) {
0034 *array &= 0xffffffff;
0035 *array |= ((u64)data->ins_lat << 32);
0036 }
0037 }
0038
0039 const char *arch_perf_header_entry(const char *se_header)
0040 {
0041 if (!strcmp(se_header, "Local INSTR Latency"))
0042 return "Finish Cyc";
0043 else if (!strcmp(se_header, "INSTR Latency"))
0044 return "Global Finish_cyc";
0045 else if (!strcmp(se_header, "Local Pipeline Stage Cycle"))
0046 return "Dispatch Cyc";
0047 else if (!strcmp(se_header, "Pipeline Stage Cycle"))
0048 return "Global Dispatch_cyc";
0049 return se_header;
0050 }
0051
0052 int arch_support_sort_key(const char *sort_key)
0053 {
0054 if (!strcmp(sort_key, "p_stage_cyc"))
0055 return 1;
0056 if (!strcmp(sort_key, "local_p_stage_cyc"))
0057 return 1;
0058 return 0;
0059 }