linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] oslat: rename cpu_mhz/cpu_hz to timer_mhz/cpu_hz
@ 2021-09-08 10:02 Nicolas Saenz Julienne
  2021-09-08 10:02 ` [PATCH 2/3] oslat: Add aarch64 support Nicolas Saenz Julienne
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2021-09-08 10:02 UTC (permalink / raw)
  To: linux-rt-users, peterx; +Cc: williams, jkacur, nsaenzju

'cpu_mhz' in oslat actually represents the frequency at which the high
frequency timer we measure with ticks. There is no need for it to match
the CPU frequency, nor will do on all supported architectures. So rename
it to 'timer_mhz' in order to better match reality.

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
---
 src/oslat/oslat.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/oslat/oslat.c b/src/oslat/oslat.c
index 6ff5ba8..a4aa5f1 100644
--- a/src/oslat/oslat.c
+++ b/src/oslat/oslat.c
@@ -123,7 +123,7 @@ struct thread {
 	pthread_t            thread_id;
 
 	/* NOTE! this is also how many ticks per us */
-	unsigned int         cpu_mhz;
+	unsigned int         timer_mhz;
 	cycles_t             int_total;
 	stamp_t              frc_start;
 	stamp_t              frc_stop;
@@ -228,7 +228,7 @@ static int move_to_core(int core_i)
 	return sched_setaffinity(0, sizeof(cpus), &cpus);
 }
 
-static cycles_t __measure_cpu_hz(void)
+static cycles_t __measure_timer_hz(void)
 {
 	struct timeval tvs, tve;
 	stamp_t s, e;
@@ -244,13 +244,13 @@ static cycles_t __measure_cpu_hz(void)
 	return (cycles_t) ((e - s) / sec);
 }
 
-static unsigned int measure_cpu_mhz(void)
+static unsigned int measure_timer_mhz(void)
 {
 	cycles_t m, mprev, d;
 
-	mprev = __measure_cpu_hz();
+	mprev = __measure_timer_hz();
 	do {
-		m = __measure_cpu_hz();
+		m = __measure_timer_hz();
 		if (m > mprev)
 			d = m - mprev;
 		else
@@ -263,7 +263,7 @@ static unsigned int measure_cpu_mhz(void)
 
 static void thread_init(struct thread *t)
 {
-	t->cpu_mhz = measure_cpu_mhz();
+	t->timer_mhz = measure_timer_mhz();
 	t->maxlat = 0;
 	t->overflow_sum = 0;
 	t->minlat = (uint64_t)-1;
@@ -288,7 +288,7 @@ static void thread_init(struct thread *t)
 
 static float cycles_to_sec(const struct thread *t, uint64_t cycles)
 {
-	return cycles / (t->cpu_mhz * 1e6);
+	return cycles / (t->timer_mhz * 1e6);
 }
 
 static void insert_bucket(struct thread *t, stamp_t value)
@@ -296,7 +296,7 @@ static void insert_bucket(struct thread *t, stamp_t value)
 	int index, us;
 	uint64_t extra;
 
-	index = value / t->cpu_mhz;
+	index = value / t->timer_mhz;
 	assert(index >= 0);
 	us = index + 1;
 	assert(us > 0);
@@ -450,7 +450,7 @@ static void write_summary(struct thread *t)
 	calculate(t);
 
 	putfield("Core", t[i].core_i, "d", "");
-	putfield("CPU Freq", t[i].cpu_mhz, "u", " (Mhz)");
+	putfield("Timer Freq", t[i].timer_mhz, "u", " (Mhz)");
 
 	for (j = 0; j < g.bucket_size; j++) {
 		if (j < g.bucket_size-1 && g.output_omit_zero_buckets) {
@@ -494,7 +494,7 @@ static void write_summary_json(FILE *f, void *data)
 	for (i = 0; i < g.n_threads; ++i) {
 		fprintf(f, "    \"%u\": {\n", i);
 		fprintf(f, "      \"cpu\": %d,\n", t[i].core_i);
-		fprintf(f, "      \"freq\": %d,\n", t[i].cpu_mhz);
+		fprintf(f, "      \"freq\": %d,\n", t[i].timer_mhz);
 		fprintf(f, "      \"min\": %" PRIu64 ",\n", t[i].minlat);
 		fprintf(f, "      \"avg\": %3lf,\n", t[i].average);
 		fprintf(f, "      \"max\": %" PRIu64 ",\n", t[i].maxlat);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-09-10 17:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 10:02 [PATCH 1/3] oslat: rename cpu_mhz/cpu_hz to timer_mhz/cpu_hz Nicolas Saenz Julienne
2021-09-08 10:02 ` [PATCH 2/3] oslat: Add aarch64 support Nicolas Saenz Julienne
2021-09-08 18:09   ` Peter Xu
2021-09-09 10:10     ` nsaenzju
2021-09-09 18:03       ` Peter Xu
2021-09-10 12:19         ` nsaenzju
2021-09-10 13:33           ` Peter Xu
2021-09-10 14:27             ` nsaenzju
2021-09-10 17:00               ` Peter Xu
2021-09-08 10:02 ` [PATCH 3/3] oslat: Allow for arch specific timer frequency measurements Nicolas Saenz Julienne
2021-09-08 18:16   ` Peter Xu
2021-09-09 10:29     ` nsaenzju
2021-09-09 18:04       ` Peter Xu
2021-09-08 14:40 ` [PATCH 1/3] oslat: rename cpu_mhz/cpu_hz to timer_mhz/cpu_hz Peter Xu
2021-09-08 16:30   ` nsaenzju
2021-09-08 17:51     ` Peter Xu
2021-09-09  9:41       ` nsaenzju
2021-09-09 18:05         ` Peter Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).