@@ -394,6 +394,8 @@ private function full_render() {
394394
395395 public function export ()
396396 {
397+ $ start = microtime (true );
398+
397399 if (empty ($ this ->mFiles )) {
398400 throw new PHPCtagsException ('No File specified. ' );
399401 }
@@ -402,17 +404,25 @@ public function export()
402404 $ this ->process ($ file );
403405 }
404406
405- return $ this ->full_render ();
407+ $ content = $ this ->full_render ();
408+
409+ $ end = microtime (true );
410+
411+ if ($ this ->mOptions ['V ' ]) {
412+ echo "It tooks " .($ end -$ start )." seconds. \n" ;
413+ }
414+
415+ return $ content ;
406416 }
407417
408418 private function process ($ file )
409419 {
410420 // Load the tag md5 data to skip unchanged files.
411- if (!isset ($ this ->tagdata ) && isset ($ this ->cachefile ) && file_exists ($ this ->cachefile )) {
421+ if (!isset ($ this ->tagdata ) && isset ($ this ->cachefile ) && file_exists (realpath ( $ this ->cachefile ) )) {
412422 if ($ this ->mOptions ['v ' ]) {
413423 echo "Loaded cache file. " .PHP_EOL ;
414424 }
415- $ this ->tagdata = unserialize (file_get_contents ($ this ->cachefile ));
425+ $ this ->tagdata = unserialize (file_get_contents (realpath ( $ this ->cachefile ) ));
416426 }
417427
418428 if (is_dir ($ file ) && isset ($ this ->mOptions ['R ' ])) {
@@ -438,14 +448,14 @@ private function process($file)
438448 try {
439449 $ this ->process_single_file ($ filename );
440450 } catch (Exception $ e ) {
441- echo "PHPParser : {$ e ->getMessage ()} - {$ filename }" . PHP_EOL ;
451+ echo "\n PHPParser : {$ e ->getMessage ()} - {$ filename }\n" ;
442452 }
443453 }
444454 } else {
445455 try {
446456 $ this ->process_single_file ($ filename );
447457 } catch (Exception $ e ) {
448- echo "PHPParser: {$ e ->getMessage ()} - {$ file }" .PHP_EOL ;
458+ echo "PHPParser: {$ e ->getMessage ()} - {$ filename }" .PHP_EOL ;
449459 }
450460 }
451461 }
@@ -457,24 +467,20 @@ private function process_single_file($filename)
457467 }
458468 $ this ->filecount ++;
459469
460- $ startfile = microtime (true );
461-
462470 $ this ->setMFile ((string ) $ filename );
463471 $ file = file_get_contents ($ this ->mFile );
464472 $ md5 = md5 ($ file );
465473 if (isset ($ this ->tagdata [$ this ->mFile ][$ md5 ])) {
466474 // The file is the same as the previous time we analyzed and saved.
467475 $ this ->mLines [$ this ->mFile ] = $ this ->tagdata [$ this ->mFile ][$ md5 ];
468- if ($ this ->mOptions ['v ' ]) {
476+ if ($ this ->mOptions ['V ' ]) {
469477 echo ". " ;
470478 }
471479 return ;
472480 }
473481
474482 $ struct = $ this ->struct ($ this ->mParser ->parse ($ file ), TRUE );
475- $ finishfile = microtime (true );
476483 $ this ->mLines [$ this ->mFile ] = $ this ->render ($ struct );
477- $ finishmerge = microtime (true );
478484 $ this ->tagdata [$ this ->mFile ][$ md5 ] = $ this ->mLines [$ this ->mFile ];
479485 if ($ this ->mOptions ['debug ' ]) {
480486 echo "Parse: " .($ finishfile - $ startfile ).", Merge: " .($ finishmerge -$ finishfile )."; ( " .$ this ->filecount .") " .$ this ->mFile .PHP_EOL ;
@@ -487,6 +493,6 @@ private function process_single_file($filename)
487493
488494class PHPCtagsException extends Exception {
489495 public function __toString () {
490- return "PHPCtags : {$ this ->message }\n" ;
496+ return "\n PHPCtags : {$ this ->message }\n" ;
491497 }
492498}
0 commit comments