The conversion to use kernvar caused an open and close at every iteration, which is very expensive. This patch opens the file at start up and closes it at exit. Signed-off-by: Steven Rostedt <srostedt@xxxxxxxxxx> --- src/cyclictest/cyclictest.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) Index: rt-tests.git/src/cyclictest/cyclictest.c =================================================================== --- rt-tests.git.orig/src/cyclictest/cyclictest.c 2008-10-13 13:01:59.000000000 -0400 +++ rt-tests.git/src/cyclictest/cyclictest.c 2008-10-13 15:01:00.000000000 -0400 @@ -133,6 +133,8 @@ static int oscope_reduction = 1; static int tracetype; static int lockall = 0; +static int traceenable_fd = -1; + /* Backup of kernel variables that we modify */ static struct kvars { char name[KVARNAMELEN]; @@ -276,20 +278,25 @@ static inline long calcdiff(struct times return diff; } +void set_trace_enable(char val) +{ + write(traceenable_fd, &val, 1); +} + void tracing(int on) { if (on) { switch (kernelversion) { case KV_26_LT18: gettimeofday(0,(struct timezone *)1); break; case KV_26_LT24: prctl(0, 1); break; - case KV_26_CURR: setkernvar("tracing_enabled", "1"); break; + case KV_26_CURR: set_trace_enable('1'); break; default: break; } } else { switch (kernelversion) { case KV_26_LT18: gettimeofday(0,0); break; case KV_26_LT24: prctl(0, 0); break; - case KV_26_CURR: setkernvar("tracing_enabled", "0"); break; + case KV_26_CURR: set_trace_enable('0'); break; default: break; } } @@ -846,7 +853,8 @@ int main(int argc, char **argv) strcpy(testname, debugfileprefix); strcat(testname, "tracing_enabled"); - if (access(testname, R_OK)) { + traceenable_fd = open(testname, O_RDWR); + if (traceenable_fd < 0) { fprintf(stderr, "ERROR: %s not found\n" "debug fs not mounted, " "TRACERs not configured?\n", testname); @@ -958,5 +966,8 @@ int main(int argc, char **argv) if (kernelversion != KV_26_CURR) restorekernvars(); + if (traceenable_fd >= 0) + close(traceenable_fd); + exit(ret); } -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html