Skip to contentSkip to conversation

signaltest: Only print from the first thread stats when quiet

PATCH In review Daniel Wagner 2 participants 2 messages Sep 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/4 signaltest: Only print from the first thread stats when quiet

When the quiet option is used don't print all threads stats. The first thread will pause every 16 cycles for 10000us. This will show up in the max values for all other threads when the final results are printed:

 # signaltest -q  -D 2s
 T: 0 ( 4517) P: 0 C:   3121 Min:      5 Act:    8 Avg:    8 Max:      19
 T: 1 ( 4518) P: 0 C:   3121 Min:      5 Act:10065 Avg:  639 Max:   10073

We could also remove the sleep but then the system gets fully loaded by the test. Furthermore, we would keep the path pretty hot and that's not ideal if one wants to test the eratic signal behavior. So only consider the first thread for the stats.

---
v2: add brackets to make it easier to read

 src/signaltest/signaltest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/signaltest/signaltest.c +1 -1
index 0bf075456ab6..a67eddaf8420 100644
@@ -417,7 +417,7 @@ int main(int argc, char **argv)
 			pthread_kill(stat[i].thread, SIGTERM);
 		if (stat[i].threadstarted) {
 			pthread_join(stat[i].thread, NULL);
-			if (quiet)
+			if (quiet && (i == 0))
 				print_stat(&par[i], i, 0);
 		}
 		if (stat[i].values)
Signature · 1 line
2.28.0
#1 lore raw
Quoted 38 lines · Daniel Wagner

When the quiet option is used don't print all threads stats. The first thread will pause every 16 cycles for 10000us. This will show up in the max values for all other threads when the final results are printed:

 # signaltest -q  -D 2s
 T: 0 ( 4517) P: 0 C:   3121 Min:      5 Act:    8 Avg:    8 Max:      19
 T: 1 ( 4518) P: 0 C:   3121 Min:      5 Act:10065 Avg:  639 Max:   10073

We could also remove the sleep but then the system gets fully loaded by the test. Furthermore, we would keep the path pretty hot and that's not ideal if one wants to test the eratic signal behavior. So only consider the first thread for the stats.

---
v2: add brackets to make it easier to read

 src/signaltest/signaltest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/signaltest/signaltest.c +1 -1
index 0bf075456ab6..a67eddaf8420 100644
@@ -417,7 +417,7 @@ int main(int argc, char **argv)
 			pthread_kill(stat[i].thread, SIGTERM);
 		if (stat[i].threadstarted) {
 			pthread_join(stat[i].thread, NULL);
-			if (quiet)
+			if (quiet && (i == 0))
 				print_stat(&par[i], i, 0);
 		}
 		if (stat[i].values)
Signature · 1 line
2.28.0