@@ -615,6 +615,7 @@ static void *timerthread(void *param)
setitimer(ITIMER_REAL, &itimer, NULL);
}
+ rt_test_start();
stat->threadstarted++;
while (!shutdown) {
@@ -82,6 +82,8 @@ static inline int64_t calctime(struct timespec t)
void rt_init(int argc, char *argv[]);
+void rt_test_start(void);
+
void rt_write_json(const char *filename,
void (*cb)(FILE *, void *), void *data);
@@ -30,6 +30,7 @@
#define TRACEBUFSIZ 1024
#define MAX_COMMAND_LINE 4096
+#define MAX_TS_SIZE 64
static char debugfileprefix[MAX_PATH];
static char *fileprefix;
@@ -37,6 +38,7 @@ static int trace_fd = -1;
static int tracemark_fd = -1;
static __thread char tracebuf[TRACEBUFSIZ];
static char cmdline[MAX_COMMAND_LINE];
+static char ts_start[MAX_TS_SIZE];
/*
* Finds the tracing directory in a mounted debugfs
@@ -514,16 +516,31 @@ void rt_init(int argc, char *argv[])
}
}
+static void get_timestamp(char *tsbuf)
+{
+ struct timeval tv;
+ struct tm *tm;
+ time_t t;
+
+ gettimeofday(&tv, NULL);
+ t = tv.tv_sec;
+ tm = localtime(&t);
+ /* RFC 2822-compliant date format */
+ strftime(tsbuf, MAX_TS_SIZE, "%a, %d %b %Y %T %z", tm);
+}
+
+void rt_test_start(void)
+{
+ get_timestamp(ts_start);
+}
+
void rt_write_json(const char *filename,
void (*cb)(FILE *, void *), void *data)
{
unsigned char buf[1];
struct utsname uts;
- struct timeval tv;
- char tsbuf[64];
- struct tm *tm;
+ char ts_end[MAX_TS_SIZE];
FILE *f, *s;
- time_t t;
size_t n;
int rt = 0;
@@ -535,11 +552,7 @@ void rt_write_json(const char *filename,
err_exit(errno, "Failed to open '%s'\n", filename);
}
- gettimeofday(&tv, NULL);
- t = tv.tv_sec;
- tm = localtime(&t);
- /* RFC 2822-compliant date format */
- strftime(tsbuf, sizeof(tsbuf), "%a, %d %b %Y %T %z", tm);
+ get_timestamp(ts_end);
s = fopen("/sys/kernel/realtime", "r");
if (s) {
@@ -556,7 +569,8 @@ void rt_write_json(const char *filename,
fprintf(f, " \"file_version\": 1,\n");
fprintf(f, " \"cmdline:\": \"%s\",\n", cmdline);
fprintf(f, " \"rt_test_version:\": \"%1.2f\",\n", VERSION);
- fprintf(f, " \"finished\": \"%s\",\n", tsbuf);
+ fprintf(f, " \"start_time\": \"%s\",\n", ts_start);
+ fprintf(f, " \"end_time\": \"%s\",\n", ts_end);
fprintf(f, " \"sysinfo\": {\n");
fprintf(f, " \"sysname\": \"%s\",\n", uts.sysname);
fprintf(f, " \"nodename\": \"%s\",\n", uts.nodename);
@@ -854,6 +854,7 @@ int main(int argc, char *argv[])
printf("Test starts...\n");
/* Reset n_threads to always run on all the cores */
g.n_threads = g.n_threads_total;
+ rt_test_start();
run_expt(threads, g.runtime);
if (!g.quiet)
@@ -583,6 +583,7 @@ int main(int argc, char *argv[])
sigemptyset(&sigset);
pthread_sigmask(SIG_SETMASK, &sigset, NULL);
+ rt_test_start();
do {
int newsamples = 0, newtimeoutcount = 0;
int minsamples = INT_MAX;
@@ -468,6 +468,7 @@ int main(int argc, char *argv[])
maindelay.tv_sec = 0;
maindelay.tv_nsec = 50000000; /* 50 ms */
+ rt_test_start();
while (!shutdown) {
for (i = 0; i < num_threads; i++)
shutdown |= receiver[i].shutdown | sender[i].shutdown;
@@ -621,6 +621,7 @@ int main (int argc, char **argv)
setup_ftrace_marker();
+ rt_test_start();
for (loop=0; loop < nr_runs; loop++) {
unsigned long long end;
@@ -1213,6 +1213,7 @@ int main(int argc, char **argv)
if (duration)
alarm(duration);
+ rt_test_start();
loop(sched_data, nr_threads);
for (i = 0; i < nr_threads; i++) {
@@ -500,6 +500,7 @@ int main(int argc, char **argv)
strerror(status));
}
+ rt_test_start();
while (!shutdown) {
int allstarted = 1;
@@ -652,6 +652,7 @@ int main(int argc, char *argv[])
&sender[i]);
}
+ rt_test_start();
while (!mustshutdown) {
for (i = 0; i < num_threads; i++)
mustshutdown |= receiver[i].shutdown |
@@ -724,6 +724,7 @@ int main(int argc, char *argv[])
&sender[i]);
}
+ rt_test_start();
while (!mustshutdown) {
for (i = 0; i < num_threads; i++)
mustshutdown |= receiver[i].shutdown |
Store the start time when the test starts to execute in the JSON output. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/cyclictest/cyclictest.c | 1 + src/include/rt-utils.h | 2 ++ src/lib/rt-utils.c | 34 +++++++++++++++++++-------- src/oslat/oslat.c | 1 + src/pmqtest/pmqtest.c | 1 + src/ptsematest/ptsematest.c | 1 + src/rt-migrate-test/rt-migrate-test.c | 1 + src/sched_deadline/cyclicdeadline.c | 1 + src/signaltest/signaltest.c | 1 + src/sigwaittest/sigwaittest.c | 1 + src/svsematest/svsematest.c | 1 + 11 files changed, 35 insertions(+), 10 deletions(-)