linux - Is it feasible to record a program state in Valgrind/DrMemory and then restore that? -
i have program loads big chunk of data @ startup. takes rather long time , therefore creates overhead when running valgrind (memcheck
)/drmemory. when invoking program several times different arguments, takes considerable amount of time
my idea use fork()
right after data loading phase , hand children off valgrind/drmemory. if loading phase runs under valgrind/drmemory, overhead occur once , fork
ed child processes should able use preloaded data there.
is feasible record program state , declare untainted , later restore state in valgrind (memcheck
) or drmemory?
note: i'm interested in unixoid platforms, limiting linux alone fine.
my idea use fork() right after data loading phase , hand children off valgring/drmemory.
that's not feasible many reasons. example, glibc
cache results of syscall(sys_getpid)
in internal variable, , having multiple processes believe have same pid (which !=
real pid) obvious recipe disaster.
that said, stops running valgrind --trace-children=yes
, fork
ing child processes after initialization? each of child processes can this:
char buf[path_max]; sprintf(buf, "/tmp/parameters-for-%d", getpid()); while (true) { if (file *fp = fopen(buf, "r")) { // read parameters child, , exercise appropriate code paths return run_with_parameters(fp); } sleep(1); }
when want child n
run, echo "foo bar baz" > /tmp/parameters-for-n
, wait complete. other children nicely busy-waiting until ready use them.
Comments
Post a Comment