1
0
Fork 0

Generate callstack value from inside Profiler::saveTimestamp

- Save a massive amount of time computing callstacks when profiling is disabled
This commit is contained in:
Hypolite Petovan 2020-07-27 00:22:07 -04:00
commit afb882048e
13 changed files with 42 additions and 39 deletions

View file

@ -256,7 +256,7 @@ class Addon
$stamp1 = microtime(true);
$f = file_get_contents("addon/$addon/$addon.php");
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file");
$r = preg_match("|/\*.*\*/|msU", $f, $m);

View file

@ -56,7 +56,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->getAllKeys($prefix);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
}
@ -70,7 +70,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->get($key);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
}
@ -84,7 +84,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->set($key, $value, $ttl);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
}
@ -98,7 +98,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->delete($key);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
}
@ -112,7 +112,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->clear($outdated);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
}
@ -127,7 +127,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->add($key, $value, $ttl);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {
@ -145,7 +145,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->compareSet($key, $oldValue, $newValue, $ttl);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {
@ -163,7 +163,7 @@ class ProfilerCache implements ICache, IMemoryCache
$return = $this->cache->compareDelete($key, $value);
$this->profiler->saveTimestamp($time, 'cache', System::callstack());
$this->profiler->saveTimestamp($time, 'cache');
return $return;
} else {

View file

@ -92,7 +92,7 @@ class Renderer
throw new InternalServerErrorException($message);
}
DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "rendering");
return $output;
}
@ -121,7 +121,7 @@ class Renderer
throw new InternalServerErrorException($message);
}
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file");
return $template;
}

View file

@ -90,7 +90,7 @@ class Theme
$stamp1 = microtime(true);
$theme_file = file_get_contents("view/theme/$theme/theme.php");
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
DI::profiler()->saveTimestamp($stamp1, "file");
$result = preg_match("|/\*.*\*/|msU", $theme_file, $matches);