merge slow-page-log into tracer, fixes #673
This commit is contained in:
parent
99646a4b00
commit
4cadce1de0
@ -108,8 +108,8 @@ function send_event(Event $event): void
|
|||||||
$method_name = "on".str_replace("Event", "", get_class($event));
|
$method_name = "on".str_replace("Event", "", get_class($event));
|
||||||
|
|
||||||
// send_event() is performance sensitive, and with the number
|
// send_event() is performance sensitive, and with the number
|
||||||
// of times context gets called the time starts to add up
|
// of times tracer gets called the time starts to add up
|
||||||
$tracer_enabled = constant('EVENT_TRACE');
|
$tracer_enabled = constant('TRACE_FILE');
|
||||||
|
|
||||||
if ($tracer_enabled) $_tracer->begin(get_class($event));
|
if ($tracer_enabled) $_tracer->begin(get_class($event));
|
||||||
// SHIT: http://bugs.php.net/bug.php?id=35106
|
// SHIT: http://bugs.php.net/bug.php?id=35106
|
||||||
|
@ -33,7 +33,6 @@ _d("DEBUG", false); // boolean print various debugging details
|
|||||||
_d("DEBUG_SQL", false); // boolean dump SQL queries to data/sql.log
|
_d("DEBUG_SQL", false); // boolean dump SQL queries to data/sql.log
|
||||||
_d("DEBUG_CACHE", false); // boolean dump cache queries to data/cache.log
|
_d("DEBUG_CACHE", false); // boolean dump cache queries to data/cache.log
|
||||||
_d("COVERAGE", false); // boolean activate xdebug coverage monitor
|
_d("COVERAGE", false); // boolean activate xdebug coverage monitor
|
||||||
_d("EVENT_TRACE", null); // string file to log performance data into
|
|
||||||
_d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers
|
_d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers
|
||||||
_d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes
|
_d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes
|
||||||
_d("SPEED_HAX", false); // boolean do some questionable things in the name of performance
|
_d("SPEED_HAX", false); // boolean do some questionable things in the name of performance
|
||||||
@ -47,7 +46,8 @@ _d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,set
|
|||||||
_d("EXTRA_EXTS", ""); // string optional extra extensions
|
_d("EXTRA_EXTS", ""); // string optional extra extensions
|
||||||
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
|
_d("BASE_URL", null); // string force a specific base URL (default is auto-detect)
|
||||||
_d("MIN_PHP_VERSION", '7.1');// string minimum supported PHP version
|
_d("MIN_PHP_VERSION", '7.1');// string minimum supported PHP version
|
||||||
_d("SLOW_PAGES", null); // float log pages which take more time than this
|
_d("TRACE_FILE", null); // string file to log performance data into
|
||||||
|
_d("TRACE_THRESHOLD", 0.0); // float log pages which take more time than this many seconds
|
||||||
_d("ENABLED_MODS", "imageboard");
|
_d("ENABLED_MODS", "imageboard");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -390,19 +390,6 @@ function get_debug_info(): string
|
|||||||
return $debug;
|
return $debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
function log_slow(): void
|
|
||||||
{
|
|
||||||
global $_shm_load_start;
|
|
||||||
if (!is_null(SLOW_PAGES)) {
|
|
||||||
$_time = microtime(true) - $_shm_load_start;
|
|
||||||
if ($_time > SLOW_PAGES) {
|
|
||||||
$_query = _get_query();
|
|
||||||
$_dbg = get_debug_info();
|
|
||||||
file_put_contents("data/slow-pages.log", "$_time $_query $_dbg\n", FILE_APPEND | LOCK_EX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||||
* Request initialisation stuff *
|
* Request initialisation stuff *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user