Skip to contentSkip to conversation

oslat: Remove redundant include

PATCH In review Nicolas Saenz Julienne 3 participants 8 messages Jul 7, 2021 – Jul 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 oslat: Remove redundant include

inttypes.h is already included above.

---
 src/oslat/oslat.c | 1 -
 1 file changed, 1 deletion(-)
src/oslat/oslat.c +0 -1
index 6108fed..1cba6fc 100644
@@ -29,7 +29,6 @@
 #include <numa.h>
 #include <math.h>
 #include <limits.h>
-#include <inttypes.h>
 
 #include <sys/prctl.h>
 #include <sys/stat.h>
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 oslat: Don't take trace_threshold into account during preheat

The point of preheat is to make sure CPUs are out of idle and running at max frequency by the time the real test starts. So it's expected to incur into extra latencies we don't really mean to measure. With this in mind, it doesn't make sense to take into account the trace threshold during that run. So don't do it.

Note that this has been observed in practice. The threshold would be hit during preheat but not during the real test.

---
 src/oslat/oslat.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
src/oslat/oslat.c +7 -4
index 1cba6fc..6ff5ba8 100644
@@ -29,6 +29,7 @@
 #include <numa.h>
 #include <math.h>
 #include <limits.h>
+#include <stdbool.h>
 
 #include <sys/prctl.h>
 #include <sys/stat.h>
@@ -150,6 +151,7 @@ struct thread {
 struct global {
 	/* Configuration. */
 	unsigned int          runtime_secs;
+	bool		      preheat;
 	/*
 	 * Number of threads running for current test
 	 * (either pre heat or real run)
@@ -299,7 +301,7 @@ static void insert_bucket(struct thread *t, stamp_t value)
 	us = index + 1;
 	assert(us > 0);
 
-	if (g.trace_threshold && us >= g.trace_threshold) {
+	if (!g.preheat && g.trace_threshold && us >= g.trace_threshold) {
 		char *line = "%s: Trace threshold (%d us) triggered with %u us!\n"
 		    "Stopping the test.\n";
 		tracemark(line, g.app_name, g.trace_threshold, us);
@@ -515,11 +517,12 @@ static void write_summary_json(FILE *f, void *data)
 	fprintf(f, "  }\n");
 }
 
-static void run_expt(struct thread *threads, int runtime_secs)
+static void run_expt(struct thread *threads, int runtime_secs, bool preheat)
 {
 	int i;
 
 	g.runtime_secs = runtime_secs;
+	g.preheat = preheat;
 	g.n_threads_started = 0;
 	g.n_threads_running = 0;
 	g.n_threads_finished = 0;
@@ -846,14 +849,14 @@ int main(int argc, char *argv[])
 		g.n_threads = 1;
 	else
 		g.n_threads = g.n_threads_total;
-	run_expt(threads, 1);
+	run_expt(threads, 1, true);
 	record_bias(threads);
 
 	if (!g.quiet)
 		printf("Test starts...\n");
 	/* Reset n_threads to always run on all the cores */
 	g.n_threads = g.n_threads_total;
-	run_expt(threads, g.runtime);
+	run_expt(threads, g.runtime, false);
 
 	if (!g.quiet)
 		printf("Test completed.\n\n");
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] oslat: Don't take trace_threshold into account during preheat

Quoted 10 lines · Nicolas Saenz Julienne

The point of preheat is to make sure CPUs are out of idle and running at max frequency by the time the real test starts. So it's expected to incur into extra latencies we don't really mean to measure. With this in mind, it doesn't make sense to take into account the trace threshold during that run. So don't do it.

Note that this has been observed in practice. The threshold would be hit during preheat but not during the real test.

Signature · 1 line
Peter Xu
#3 lore raw

Re: [PATCH 2/2] oslat: Don't take trace_threshold into account during preheat

Quoted 7 lines · Peter Xu
Quoted 6 lines · Nicolas Saenz Julienne

The point of preheat is to make sure CPUs are out of idle and running at max frequency by the time the real test starts. So it's expected to incur into extra latencies we don't really mean to measure. With this in mind, it doesn't make sense to take into account the trace threshold during that run. So don't do it.

Quoted 11 lines
Quoted 4 lines

Note that this has been observed in practice. The threshold would be hit during preheat but not during the real test.

Signature · 1 line
Peter Xu

Thanks, added

#4 lore raw

Re: [PATCH 2/2] oslat: Don't take trace_threshold into account during preheat

In reply to Nicolas Saenz Julienne
Quoted 78 lines · Nicolas Saenz Julienne

The point of preheat is to make sure CPUs are out of idle and running at max frequency by the time the real test starts. So it's expected to incur into extra latencies we don't really mean to measure. With this in mind, it doesn't make sense to take into account the trace threshold during that run. So don't do it.

Note that this has been observed in practice. The threshold would be hit during preheat but not during the real test.

---
 src/oslat/oslat.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
src/oslat/oslat.c +7 -4
index 1cba6fc..6ff5ba8 100644
@@ -29,6 +29,7 @@
 #include <numa.h>
 #include <math.h>
 #include <limits.h>
+#include <stdbool.h>
 
 #include <sys/prctl.h>
 #include <sys/stat.h>
@@ -150,6 +151,7 @@ struct thread {
 struct global {
 	/* Configuration. */
 	unsigned int          runtime_secs;
+	bool		      preheat;
 	/*
 	 * Number of threads running for current test
 	 * (either pre heat or real run)
@@ -299,7 +301,7 @@ static void insert_bucket(struct thread *t, stamp_t value)
 	us = index + 1;
 	assert(us > 0);
 
-	if (g.trace_threshold && us >= g.trace_threshold) {
+	if (!g.preheat && g.trace_threshold && us >= g.trace_threshold) {
 		char *line = "%s: Trace threshold (%d us) triggered with %u us!\n"
 		    "Stopping the test.\n";
 		tracemark(line, g.app_name, g.trace_threshold, us);
@@ -515,11 +517,12 @@ static void write_summary_json(FILE *f, void *data)
 	fprintf(f, "  }\n");
 }
 
-static void run_expt(struct thread *threads, int runtime_secs)
+static void run_expt(struct thread *threads, int runtime_secs, bool preheat)
 {
 	int i;
 
 	g.runtime_secs = runtime_secs;
+	g.preheat = preheat;
 	g.n_threads_started = 0;
 	g.n_threads_running = 0;
 	g.n_threads_finished = 0;
@@ -846,14 +849,14 @@ int main(int argc, char *argv[])
 		g.n_threads = 1;
 	else
 		g.n_threads = g.n_threads_total;
-	run_expt(threads, 1);
+	run_expt(threads, 1, true);
 	record_bias(threads);
 
 	if (!g.quiet)
 		printf("Test starts...\n");
 	/* Reset n_threads to always run on all the cores */
 	g.n_threads = g.n_threads_total;
-	run_expt(threads, g.runtime);
+	run_expt(threads, g.runtime, false);
 
 	if (!g.quiet)
 		printf("Test completed.\n\n");
Signature · 1 line
2.31.1
#7 lore raw
In reply to Nicolas Saenz Julienne
Quoted 23 lines · Nicolas Saenz Julienne

inttypes.h is already included above.

---
 src/oslat/oslat.c | 1 -
 1 file changed, 1 deletion(-)
src/oslat/oslat.c +0 -1
index 6108fed..1cba6fc 100644
@@ -29,7 +29,6 @@
 #include <numa.h>
 #include <math.h>
 #include <limits.h>
-#include <inttypes.h>
 
 #include <sys/prctl.h>
 #include <sys/stat.h>
Signature · 1 line
2.31.1