Commit eb56ac92 authored by Tamer Tas's avatar Tamer Tas Committed by V8 LUCI CQ

[run_perf] Replace usage of numpy with python3 statistics package

R=machenbach@chromium.org,liviurau@chromium.org,alexschulze@chromium.org

Bug: v8:12610
Change-Id: I24a1af48bf7a748e06c719439fb368ad75dd0160
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3448377
Auto-Submit: Tamer Tas <tmrts@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79013}
parent 8eb43b92
......@@ -119,13 +119,21 @@ import sys
import time
import traceback
import numpy
from testrunner.local import android
from testrunner.local import command
from testrunner.local import utils
from testrunner.objects.output import Output, NULL_OUTPUT
from math import sqrt
# NOTE: added import here to prevent breakages during the py2/3 migration,
# once we enable python3 only, we can move the import up
try:
from numpy import mean
from numpy import std as stdev
except ImportError:
from statistics import mean, stdev
# for py2/py3 compatibility
try:
basestring # Python 2
......@@ -265,11 +273,11 @@ class ResultTracker(object):
return False
logging.debug(' Results: %d entries', len(results))
mean = numpy.mean(results)
mean_stderr = numpy.std(results) / numpy.sqrt(len(results))
logging.debug(' Mean: %.2f, mean_stderr: %.2f', mean, mean_stderr)
logging.info('>>> Confidence level is %.2f', mean / (1000.0 * mean_stderr))
return confidence_level * mean_stderr < mean / 1000.0
avg = mean(results)
avg_stderr = stdev(results) / sqrt(len(results))
logging.debug(' Mean: %.2f, mean_stderr: %.2f', avg, avg_stderr)
logging.info('>>> Confidence level is %.2f', avg / (1000.0 * avg_stderr))
return confidence_level * avg_stderr < avg / 1000.0
def __str__(self): # pragma: no cover
return json.dumps(self.ToDict(), indent=2, separators=(',', ': '))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment