From: Marek P. <ma...@us...> - 2002-02-10 18:36:16
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv5925/src/setup Modified Files: setup.cpp setup.h Log Message: fixes; calltree implementation (for exact cpu profiling) Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** setup.cpp 31 Jan 2002 12:31:00 -0000 1.8 --- setup.cpp 10 Feb 2002 18:36:14 -0000 1.9 *************** *** 48,51 **** --- 48,52 ---- cpu.traceDepth = 2; cpu.threadsEnabled = 1; + cpu.callTreeEnabled = 1; mon.turnedOn = 1; *************** *** 57,61 **** } ! void Setup::processOptions(char* options) { char option[100]; --- 58,62 ---- } ! void Setup::processOptions( char* options) { char option[100]; *************** *** 63,83 **** int len; ! if (!options) return; ! while (end = strchr(options, ',')) { len = end - options; ! if ((len > 0) && (len < 100)) { ! strncpy(option, options, len); option[len] = '\0'; ! processOption(option); } options = end + 1; } ! len = strlen(options); ! if ((len > 0) && (len < 100)) { ! strcpy(option, options); ! processOption(option); } } --- 64,89 ---- int len; ! if( !options) return; ! while( end = strchr(options, ',')) { len = end - options; ! ! if( (len > 0) && (len < 100)) { ! ! strncpy( option, options, len); option[len] = '\0'; ! processOption( option); } + options = end + 1; } ! len = strlen( options); ! ! if( (len > 0) && (len < 100)) { ! ! strcpy( option, options); ! processOption( option); } } *************** *** 95,98 **** --- 101,105 ---- cout << "build: " << __DATE__ << " " << __TIME__ << endl << endl; } + return; } *************** *** 102,238 **** } ! void Setup::setParameter(char* name, char* value) { ! if (strcmp(name, "alloc") == 0) { ! if (strcmp(value, "on") == 0) ! alloc.turnedOn = 1; ! else if (strcmp(value, "off") == 0) ! alloc.turnedOn = 0; return; } ! if (strcmp(name, "alloc_level") == 0) { ! if (strcmp(value, "object") == 0) ! alloc.level = LEVEL_OBJECT; ! else if (strcmp(value, "method") == 0) ! alloc.level = LEVEL_METHOD; ! else if (strcmp(value, "trace") == 0) ! alloc.level = LEVEL_TRACE; return; } ! if (strcmp(name, "alloc_trace_depth") == 0) { ! int depth = atoi(value); ! if (depth > 0) { ! if (depth > MAX_TRACE) depth = MAX_TRACE; alloc.traceDepth = depth; } return; } ! if (strcmp(name, "alloc_thread") == 0) { ! if (strcmp(value, "on") == 0) ! alloc.threadsEnabled = 1; ! else if (strcmp(value, "off") == 0) ! alloc.threadsEnabled = 0; return; } ! if (strcmp(name, "cpu") == 0) { ! if (strcmp(value, "on") == 0) ! cpu.turnedOn = 1; ! else if (strcmp(value, "off") == 0) ! cpu.turnedOn = 0; return; } ! if (strcmp(name, "cpu_method") == 0) { ! if (strcmp(value, "exact") == 0) ! cpu.sampling = 0; ! else if (strcmp(value, "sampling") == 0) ! cpu.sampling = 1; return; } ! if (strcmp(name, "cpu_level") == 0) { ! if (strcmp(value, "method") == 0) ! cpu.level = LEVEL_METHOD; ! else if (strcmp(value, "trace") == 0) ! cpu.level = LEVEL_TRACE; return; } ! if (strcmp(name, "cpu_trace_depth") == 0) { ! int depth = atoi(value); ! if (depth > 0) { ! if (depth > MAX_TRACE) depth = MAX_TRACE; cpu.traceDepth = depth; } return; } ! if (strcmp(name, "cpu_thread") == 0) { ! if (strcmp(value, "on") == 0) ! cpu.threadsEnabled = 1; ! else if (strcmp(value, "off") == 0) ! cpu.threadsEnabled = 0; return; } ! if (strcmp(name, "mon") == 0) { ! if (strcmp(value, "on") == 0) ! mon.turnedOn = 1; ! else if (strcmp(value, "off") == 0) ! mon.turnedOn = 0; return; } ! if (strcmp(name, "mon_level") == 0) { ! if (strcmp(value, "method") == 0) ! mon.level = LEVEL_METHOD; ! else if (strcmp(value, "trace") == 0) ! mon.level = LEVEL_TRACE; return; } ! if (strcmp(name, "mon_trace_depth") == 0) { ! int depth = atoi(value); ! if (depth > 0) { ! if (depth > MAX_TRACE) depth = MAX_TRACE; mon.traceDepth = depth; } return; } ! if (strcmp(name, "mon_thread") == 0) { ! if (strcmp(value, "on") == 0) ! mon.threadsEnabled = 1; ! else if (strcmp(value, "off") == 0) ! mon.threadsEnabled = 0; return; --- 109,238 ---- } ! void Setup::setParameter( char* name, char* value) { ! if( !strcmp( name, "alloc")) { ! if( !strcmp( value, "on")) alloc.turnedOn = 1; ! else if( !strcmp( value, "off")) alloc.turnedOn = 0; return; } ! if( !strcmp( name, "alloc_level")) { ! if( !strcmp( value, "object")) alloc.level = LEVEL_OBJECT; ! else if( !strcmp( value, "method")) alloc.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) alloc.level = LEVEL_TRACE; return; } ! if( !strcmp( name, "alloc_trace_depth")) { ! int depth = atoi( value); ! ! if( depth > 0) { ! if( depth > MAX_TRACE) depth = MAX_TRACE; alloc.traceDepth = depth; } + return; } ! if( !strcmp( name, "alloc_thread")) { ! if( !strcmp( value, "on")) alloc.threadsEnabled = 1; ! else if( !strcmp( value, "off")) alloc.threadsEnabled = 0; return; } ! if( !strcmp( name, "cpu")) { ! if( !strcmp( value, "on")) cpu.turnedOn = 1; ! else if( !strcmp( value, "off")) cpu.turnedOn = 0; return; } ! if( !strcmp( name, "cpu_method")) { ! if( !strcmp( value, "exact")) cpu.sampling = 0; ! else if( !strcmp( value, "sampling")) cpu.sampling = 1; return; } ! if( !strcmp( name, "cpu_level")) { ! if( !strcmp( value, "method")) cpu.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) cpu.level = LEVEL_TRACE; return; } ! if( !strcmp( name, "cpu_trace_depth")) { ! int depth = atoi( value); ! ! if( depth > 0) { ! if( depth > MAX_TRACE) depth = MAX_TRACE; cpu.traceDepth = depth; } + return; } ! if( !strcmp( name, "cpu_thread")) { ! if( !strcmp( value, "on")) cpu.threadsEnabled = 1; ! else if( !strcmp( value, "off")) cpu.threadsEnabled = 0; ! ! return; ! } ! ! if( !strcmp( name, "cpu_calltree")) { ! ! if( !strcmp( value, "on")) cpu.callTreeEnabled = 1; ! else if( !strcmp( value, "off")) cpu.callTreeEnabled = 0; return; } ! if( !strcmp( name, "mon")) { ! if( !strcmp( value, "on")) mon.turnedOn = 1; ! else if( !strcmp( value, "off")) mon.turnedOn = 0; return; } ! if( !strcmp( name, "mon_level")) { ! if( !strcmp( value, "method")) mon.level = LEVEL_METHOD; ! else if( !strcmp( value, "trace")) mon.level = LEVEL_TRACE; return; } ! if( !strcmp( name, "mon_trace_depth")) { ! int depth = atoi( value); ! if( depth > 0) { ! ! if( depth > MAX_TRACE) depth = MAX_TRACE; mon.traceDepth = depth; } + return; } ! if( !strcmp( name, "mon_thread")) { ! if( !strcmp( value, "on")) mon.threadsEnabled = 1; ! else if( !strcmp( value, "off")) mon.threadsEnabled = 0; return; Index: setup.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** setup.h 21 Nov 2001 22:31:49 -0000 1.10 --- setup.h 10 Feb 2002 18:36:14 -0000 1.11 *************** *** 114,117 **** --- 114,120 ---- /// whether resolution to threads is enabled int threadsEnabled; + + /// whether calltree is enabled + int callTreeEnabled; }; *************** *** 199,203 **** ** @param options command line options string */ ! void processOptions(char* options); private: --- 202,206 ---- ** @param options command line options string */ ! void processOptions( char* options); private: *************** *** 207,211 **** ** @param option option string */ ! void processOption(char* option); /** Sets parameter. --- 210,214 ---- ** @param option option string */ ! void processOption( char* option); /** Sets parameter. *************** *** 214,218 **** ** @param value parameter value */ ! void setParameter(char* name, char* value); }; --- 217,221 ---- ** @param value parameter value */ ! void setParameter( char* name, char* value); }; |