Calculation errors - #1395
Open
ArneTR wants to merge 3 commits into
Open
Conversation
…ower is alrady in mW
… wrong summation in reconstruction of RUNTIME phase
Member
Author
|
When looking at this PR please also look at the AI suggestion to less approximate the runtime phase reconstruction: Second update query in # Step 3: compute weighted MEAN correctly
DB().query('''
WITH durations AS (
SELECT
run_id,
phase,
value AS duration_us
FROM phase_stats
WHERE run_id = %s
AND metric = 'phase_time_syscall_system'
AND detail_name = '[SYSTEM]'
AND unit = 'us'
AND type = 'TOTAL'
AND hidden IS FALSE
),
weighted AS (
SELECT
p.metric,
p.detail_name,
p.unit,
SUM(p.value * d.duration_us) / NULLIF(SUM(d.duration_us), 0) AS weighted_mean,
MAX(p.max_value) AS max_value,
MIN(p.min_value) AS min_value
FROM phase_stats p
JOIN durations d
ON d.run_id = p.run_id
AND d.phase = p.phase
WHERE p.run_id = %s
AND p.phase = %s
AND p.hidden IS FALSE
AND p.type = 'TOTAL'
GROUP BY p.metric, p.detail_name, p.unit
)
UPDATE phase_stats t
SET value = w.weighted_mean
FROM weighted w
WHERE t.run_id = %s
AND t.phase = %s
AND t.metric = w.metric
AND t.detail_name = w.detail_name
AND t.unit = w.unit
AND t.type = 'MEAN'
''', params=(run_id, run_id, runtime_phase, run_id, runtime_phase)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two calculation errors in GMT in some rarely used values:
TODO: The PR needs tests for the new fixes as they were not covered by tests so far