mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 12:30:56 +01:00
Compute average costs more correctly in Multimeter
Summary: Ref T6930. We were dividing total cost by number of samples, but should more accurately divide it by the sum of the sample rates. This produces a more meaningful number. Test Plan: Saw a more meaningful number in the UI. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T6930 Differential Revision: https://secure.phabricator.com/D12655
This commit is contained in:
parent
1168a8c0a0
commit
e6e0df6aff
1 changed files with 5 additions and 2 deletions
|
@ -56,7 +56,10 @@ final class MultimeterSampleController extends MultimeterController {
|
|||
|
||||
$data = queryfx_all(
|
||||
$conn,
|
||||
'SELECT *, count(*) N, SUM(sampleRate * resourceCost) as totalCost
|
||||
'SELECT *,
|
||||
count(*) AS N,
|
||||
SUM(sampleRate * resourceCost) AS totalCost,
|
||||
SUM(sampleRate * resourceCost) / SUM(sampleRate) AS averageCost
|
||||
FROM %T
|
||||
WHERE %Q
|
||||
GROUP BY %Q
|
||||
|
@ -177,7 +180,7 @@ final class MultimeterSampleController extends MultimeterController {
|
|||
MultimeterEvent::formatResourceCost(
|
||||
$viewer,
|
||||
$row['eventType'],
|
||||
$row['totalCost'] / $row['N']),
|
||||
$row['averageCost']),
|
||||
MultimeterEvent::formatResourceCost(
|
||||
$viewer,
|
||||
$row['eventType'],
|
||||
|
|
Loading…
Reference in a new issue