Skip to content

Commit

Permalink
Merge branch 'MOODLE_35_STABLE' into duration-display
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood authored Jun 13, 2024
2 parents 1585cde + 0a02afa commit b868595
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
11 changes: 8 additions & 3 deletions classes/web_processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class web_processor implements processor {
protected $minduration;
/** @var int */
protected $samplems;
/** @var bool */
protected $partialsave;

/**
* Construct the web processor.
Expand All @@ -48,6 +50,7 @@ public function __construct() {
// Preload config values to avoid DB access during processing. See manager::get_altconnection() for more information.
$this->minduration = (float) get_config('tool_excimer', 'trigger_ms') / 1000.0;
$this->samplems = (int) get_config('tool_excimer', 'sample_ms');
$this->partialsave = get_config('tool_excimer', 'enable_partial_save');
}

/**
Expand All @@ -73,9 +76,11 @@ public function init(manager $manager) {
$this->profile->add_env($this->sampleset->name);
$this->profile->set('created', $this->sampleset->starttime);

$manager->get_timer()->setCallback(function () use ($manager) {
$this->process($manager, false);
});
if ($this->partialsave) {
$manager->get_timer()->setCallback(function () use ($manager) {
$this->process($manager, false);
});
}

\core_shutdown_manager::register_function(
function () use ($manager) {
Expand Down
9 changes: 7 additions & 2 deletions lang/en/tool_excimer.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
$string['enable_auto_desc'] = 'Any page will be automatically profiled if they exceed the miniumum duration.';
$string['enable_fuzzy_count'] = 'Enable fuzzy counting';
$string['enable_fuzzy_count_desc'] = 'This will cause the plugin to maintain an approximate count of page runs using the {$a}. Automatic profiling must also be enabled.';
$string['enable_partial_save'] = 'Enable partial save';
$string['enable_partial_save_desc'] = 'This will save partial profiles of slow web processes every processing interval. This
provides information about these processes while they are still running or if a container gets reaped, but the extra writes
can be problematic when experiencing large scale database issues.';
$string['expiry_s'] = 'Log expiry (days)';
$string['expiry_s_desc'] = 'Remove profiles after this long.';
$string['num_slowest'] = 'Max to save';
Expand All @@ -66,8 +70,9 @@
$string['num_slowest_by_page'] = 'Max to save by page';
$string['num_slowest_by_page_desc'] = 'Only the N slowest profiles will be kept for each script page.';
$string['noexcimerprofiler'] = 'ExcimerProfiler class does not exist so profiling cannot continue. Please check the installation instructions {$a}.';
$string['long_interval_s'] = 'Partial save interval (seconds)';
$string['long_interval_s_desc'] = 'For long running taks, save a partial profile every N seconds.';
$string['long_interval_s'] = 'Processing interval (seconds)';
$string['long_interval_s_desc'] = 'Checks the current status of long running tasks every N seconds and processes as required.
This includes saving profiles of finished cron tasks and partial saves of ongoing web processes if enabled.';
$string['task_min_duration'] = 'Task min duration (seconds)';
$string['task_min_duration_desc'] = 'For scheduled and ad-hoc tasks, the minimum approx duration, in seconds.';
$string['samplelimit'] = 'Sample limit';
Expand Down
9 changes: 9 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ function ($v) {
)
);

$settings->add(
new admin_setting_configcheckbox(
'tool_excimer/enable_partial_save',
get_string('enable_partial_save', 'tool_excimer'),
get_string('enable_partial_save_desc', 'tool_excimer'),
0
)
);

$item = new admin_setting_configtext(
'tool_excimer/trigger_ms',
get_string('request_ms', 'tool_excimer'),
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024050700;
$plugin->release = 2024050700;
$plugin->version = 2024052400;
$plugin->release = 2024052400;
$plugin->requires = 2017051500; // Moodle 3.3 for Totara support.
$plugin->supported = [35, 401]; // Supports Moodle 3.5 or later.
// TODO $plugin->incompatible = ; // Available as of Moodle 3.9.0 or later.
Expand Down

0 comments on commit b868595

Please sign in to comment.