[xdebug-dev] xdebug xdebug/xdebug_profiler.c - Added a "script" value to the profiler_output_name option. This will write

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 4 May 2006 11:55:31 +0200

Date: Thu May 4 11:55:31 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.25]
- Added a "script" value to the profiler_output_name option. This will write
  the profiler output to a filename that consists of the script's full path
  (using underscores). ie: /var/www/index.php becomes
  var_www_index_php_cachegrind.out. (Patch by Brian Shire
  <shire[@]facebook.com>).

Modified files:
           xdebug/xdebug_profiler.c (version: 1.36)

[FILE: /xdebug/xdebug_profiler.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- xdebug/xdebug_profiler.c:1.35 Sun Apr 02 05:31:03 2006 GMT
+++ xdebug/xdebug_profiler.c Thu May 04 07:55:31 2006 GMT
@@ -58,12 +58,26 @@
 int xdebug_profiler_init(char *script_name TSRMLS_DC)
 {
         char *filename;
+ char *script_name_tmp, *char_ptr;
 
         if (strcmp(XG(profiler_output_name), "crc32") == 0) {
                 filename = xdebug_sprintf("%s/cachegrind.out.%lu", XG(profiler_output_dir), xdebug_crc32(script_name, strlen(script_name)));
         } else if (strcmp(XG(profiler_output_name), "timestamp") == 0) {
                 time_t the_time = time(NULL);
                 filename = xdebug_sprintf("%s/cachegrind.out.%ld", XG(profiler_output_dir), the_time);
+ } else if (strcmp(XG(profiler_output_name), "script") == 0) {
+ script_name_tmp = estrdup(script_name + 1);
+ /* replace slashes with underscores */
+ while ((char_ptr = strpbrk(script_name_tmp, "/\\")) != NULL) {
+ char_ptr[0] = '_';
+ }
+ /* replace .php with _php */
+ char_ptr = strrchr(script_name_tmp, '.');
+ if (char_ptr) {
+ char_ptr[0] = '_';
+ }
+ filename = xdebug_sprintf("%s/%s_cachegrind.out", XG(profiler_output_dir), script_name_tmp);
+ efree(script_name_tmp);
         } else {
                 filename = xdebug_sprintf("%s/cachegrind.out.%ld", XG(profiler_output_dir), getpid());
         }
Received on Thu May 04 2006 - 11:56:01 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST