[pypy-commit] pypy new-jit-log: try init from env variable rewritten, there is currently no filtering mechanism. filtering does not make sense anymore
plan_rich
pypy.commits at gmail.com
Fri Apr 1 06:51:22 EDT 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: new-jit-log
Changeset: r83490:b8dc684ce886
Date: 2016-04-01 12:50 +0200
http://bitbucket.org/pypy/pypy/changeset/b8dc684ce886/
Log: try init from env variable rewritten, there is currently no
filtering mechanism. filtering does not make sense anymore
diff --git a/rpython/rlib/rvmprof/src/jitlog_main.h b/rpython/rlib/rvmprof/src/jitlog_main.h
--- a/rpython/rlib/rvmprof/src/jitlog_main.h
+++ b/rpython/rlib/rvmprof/src/jitlog_main.h
@@ -21,53 +21,22 @@
char *filename = getenv("JITLOG");
if (filename && filename[0]) {
- char *newfilename = NULL, *escape;
- char *colon = strchr(filename, ':');
- if (filename[0] == '+') {
- filename += 1;
- colon = NULL;
+ // mode is 775
+ mode_t mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
+ jitlog_fd = open(filename, O_WRONLY | O_CREAT, mode);
+ if (jitlog_fd == -1) {
+ perror("could not open");
+ exit(-1);
}
- if (!colon) {
- /* JITLOG=+filename (or just 'filename') --- profiling version */
- //pypy_setup_profiling();
- } else {
- /* JITLOG=prefix:filename --- conditional logging */
- int n = colon - filename;
- jitlog_prefix = malloc(n + 1);
- memcpy(jitlog_prefix, filename, n);
- //debug_prefix[n] = '\0';
- filename = colon + 1;
- }
- escape = strstr(filename, "%d");
- if (escape) {
- /* a "%d" in the filename is replaced with the pid */
- newfilename = malloc(strlen(filename) + 32);
- if (newfilename != NULL) {
- char *p = newfilename;
- memcpy(p, filename, escape - filename);
- p += escape - filename;
- sprintf(p, "%ld", (long)getpid());
- strcat(p, escape + 2);
- filename = newfilename;
- }
- }
- if (strcmp(filename, "-") != 0) {
- // mode is 775
- mode_t mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
- jitlog_fd = open(filename, O_WRONLY | O_CREAT, mode);
- }
-
- if (escape) {
- free(newfilename); /* if not null */
- /* the env var is kept and passed to subprocesses */
- } else {
+ } else {
+ jitlog_ready = 0;
+ return;
+ }
#ifndef _WIN32
- unsetenv("JITLOG");
+ unsetenv("JITLOG");
#else
- putenv("JITLOG=");
+ putenv("JITLOG=");
#endif
- }
- }
jitlog_ready = 1;
}
More information about the pypy-commit
mailing list