Files
cacti/tests/performance/profile-bootstrap.php
Thomas Vincent 8221a941a7 test(performance): [develop] add disposable browser and SQL/RRD profiling (#8336)
* perf: add disposable browser and SQL/RRD profiling

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: record profiling harness in the changelog

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 00:01:32 -07:00

28 lines
789 B
PHP

<?php
// Copyright (C) 2004-2026 The Cacti Group. GPL-2.0-or-later.
// Check before loading Cacti, connecting to a database or touching any RRD.
if (PHP_SAPI !== 'cli') {
http_response_code(403);
exit('CLI only.');
}
if (PHP_SAPI !== 'cli' || getenv('CACTI_PROFILE_DISPOSABLE') !== '1' || !is_file('/tmp/cacti-profile-disposable')) {
fwrite(STDERR, "Use the disposable profiling runner.\n");
exit(1);
}
chdir(dirname(__DIR__, 2));
require_once __DIR__ . '/../../include/global.php';
require_once CACTI_PATH_LIBRARY . '/rrd.php';
require_once CACTI_PATH_LIBRARY . '/boost.php';
$_SESSION[SESS_USER_ID] = 1;
$_SESSION['selected_theme'] = 'modern';
function profile_check(bool $condition, string $message): void {
if (!$condition) {
throw new RuntimeException($message);
}
}