Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf test: Add test for #system_tsc_freq in metrics

The value should be non-zero on Intel while zero on everything else.

Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Caleb Biggers <caleb.biggers@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Perry Taylor <perry.taylor@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20220718164312.3994191-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
6923397c 1276ade6

+13
+13
tools/perf/tests/expr.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "util/debug.h" 3 3 #include "util/expr.h" 4 + #include "util/header.h" 4 5 #include "util/smt.h" 5 6 #include "tests.h" 7 + #include <math.h> 6 8 #include <stdlib.h> 7 9 #include <string.h> 8 10 #include <linux/zalloc.h> ··· 71 69 double val, num_cpus, num_cores, num_dies, num_packages; 72 70 int ret; 73 71 struct expr_parse_ctx *ctx; 72 + bool is_intel = false; 73 + char buf[128]; 74 + 75 + if (!get_cpuid(buf, sizeof(buf))) 76 + is_intel = strstr(buf, "Intel") != NULL; 74 77 75 78 TEST_ASSERT_EQUAL("ids_union", test_ids_union(), 0); 76 79 ··· 181 174 182 175 if (num_dies) // Some platforms do not have CPU die support, for example s390 183 176 TEST_ASSERT_VAL("#num_dies >= #num_packages", num_dies >= num_packages); 177 + 178 + TEST_ASSERT_VAL("#system_tsc_freq", expr__parse(&val, ctx, "#system_tsc_freq") == 0); 179 + if (is_intel) 180 + TEST_ASSERT_VAL("#system_tsc_freq > 0", val > 0); 181 + else 182 + TEST_ASSERT_VAL("#system_tsc_freq == 0", fpclassify(val) == FP_ZERO); 184 183 185 184 /* 186 185 * Source count returns the number of events aggregating in a leader