servo: Merge #9926 - Update heartbeats and energymon profiler dependencies (from connorimes:update-em-interface-hbs-crates); r=asajeffrey

Heartbeats now on crates.io.
Updates to energymon interface for energy profiling.
Profiling script for Android.

Source-Repo: https://github.com/servo/servo
Source-Revision: 396812b6d9c43a886d32d6d0910c1c685f333baf
This commit is contained in:
Connor Imes 2016-03-10 22:40:23 +05:01
parent 80770e1c50
commit db206ff49a
8 changed files with 236 additions and 50 deletions

View File

@ -17,13 +17,11 @@ path = "../plugins"
[dependencies.util]
path = "../util"
[dependencies.hbs-pow]
git = "https://github.com/libheartbeats/heartbeats-simple-rust.git"
[dependencies.ipc-channel]
git = "https://github.com/servo/ipc-channel"
[dependencies]
hbs-pow = "0.2"
log = "0.3"
libc = "0.2"
regex = "0.1.55"

View File

@ -19,7 +19,7 @@ git = "https://github.com/energymon/energymon-rust.git"
optional = true
[dependencies.energy-monitor]
version = "0.1.0"
version = "0.2.0"
optional = true
[dependencies.plugins]

View File

@ -236,6 +236,14 @@ dependencies = [
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cmake"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cocoa"
version = "0.2.5"
@ -509,33 +517,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "energy-monitor"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "energymon"
version = "0.1.0"
source = "git+https://github.com/energymon/energymon-rust.git#637e537934cdfc2142011a910490a408ea135af2"
version = "0.2.0"
source = "git+https://github.com/energymon/energymon-rust.git#7b30c4d88ac1fcfaf7755081ebdd810c5dcf4fea"
dependencies = [
"energy-monitor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon-default-sys 0.1.0 (git+https://github.com/energymon/energymon-sys.git)",
"energy-monitor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon-default-sys 0.2.0 (git+https://github.com/energymon/energymon-sys.git)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "energymon-default-sys"
version = "0.1.0"
source = "git+https://github.com/energymon/energymon-sys.git#199cd11b36f14768a6a379843400c6a6671ffe5e"
name = "energymon-builder"
version = "0.2.0"
source = "git+https://github.com/energymon/energymon-sys.git#a0fb99b0312372958b110ae6378b5c89c2287172"
dependencies = [
"energymon-sys 0.1.0 (git+https://github.com/energymon/energymon-sys.git)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "energymon-default-sys"
version = "0.2.0"
source = "git+https://github.com/energymon/energymon-sys.git#a0fb99b0312372958b110ae6378b5c89c2287172"
dependencies = [
"energymon-builder 0.2.0 (git+https://github.com/energymon/energymon-sys.git)",
"energymon-sys 0.2.0 (git+https://github.com/energymon/energymon-sys.git)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "energymon-sys"
version = "0.1.0"
source = "git+https://github.com/energymon/energymon-sys.git#199cd11b36f14768a6a379843400c6a6671ffe5e"
version = "0.2.0"
source = "git+https://github.com/energymon/energymon-sys.git#a0fb99b0312372958b110ae6378b5c89c2287172"
dependencies = [
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -798,10 +814,19 @@ dependencies = [
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-builder"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-common-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -809,20 +834,20 @@ dependencies = [
[[package]]
name = "hbs-pow"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-rust.git#0f46659b465927a88b23b69b66602ded43dd37b7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-pow-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-pow-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-pow-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-common-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-builder 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hbs-common-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1515,7 +1540,7 @@ dependencies = [
name = "profile"
version = "0.0.1"
dependencies = [
"hbs-pow 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-rust.git)",
"hbs-pow 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1531,8 +1556,8 @@ dependencies = [
name = "profile_traits"
version = "0.0.1"
dependencies = [
"energy-monitor 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon 0.1.0 (git+https://github.com/energymon/energymon-rust.git)",
"energy-monitor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"energymon 0.2.0 (git+https://github.com/energymon/energymon-rust.git)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -221,6 +221,14 @@ dependencies = [
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cmake"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cocoa"
version = "0.2.5"
@ -726,10 +734,19 @@ dependencies = [
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-builder"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-common-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -737,20 +754,20 @@ dependencies = [
[[package]]
name = "hbs-pow"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-rust.git#0f46659b465927a88b23b69b66602ded43dd37b7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-pow-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-pow-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-pow-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-common-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-builder 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hbs-common-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1400,7 +1417,7 @@ dependencies = [
name = "profile"
version = "0.0.1"
dependencies = [
"hbs-pow 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-rust.git)",
"hbs-pow 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -214,6 +214,14 @@ dependencies = [
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cmake"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cocoa"
version = "0.2.5"
@ -708,10 +716,19 @@ dependencies = [
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-builder"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cmake 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-common-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -719,20 +736,20 @@ dependencies = [
[[package]]
name = "hbs-pow"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-rust.git#0f46659b465927a88b23b69b66602ded43dd37b7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-pow-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-pow-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hbs-pow-sys"
version = "0.2.0"
source = "git+https://github.com/libheartbeats/heartbeats-simple-sys.git#9ae3875aa26610d6155b5191f832e74410558a73"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hbs-common-sys 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-sys.git)",
"hbs-builder 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hbs-common-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1382,7 +1399,7 @@ dependencies = [
name = "profile"
version = "0.0.1"
dependencies = [
"hbs-pow 0.2.0 (git+https://github.com/libheartbeats/heartbeats-simple-rust.git)",
"hbs-pow 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -23,7 +23,7 @@ HEARTBEAT_PROFILER_CATEGORIES = [
("Compositing", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutPerform", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutStyleRecalc", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutTextShaping", HEARTBEAT_DEFAULT_WINDOW_SIZE),
# ("LayoutTextShaping", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutRestyleDamagePropagation", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutNonIncrementalReset", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("LayoutSelectorMatch", HEARTBEAT_DEFAULT_WINDOW_SIZE),
@ -56,7 +56,7 @@ HEARTBEAT_PROFILER_CATEGORIES = [
("ScriptWorkerEvent", HEARTBEAT_DEFAULT_WINDOW_SIZE),
("ApplicationHeartbeat", 100),
]
ENERGY_READER_BIN = "energymon"
ENERGY_READER_BIN = "energymon-file-provider"
ENERGY_READER_TEMP_OUTPUT = "energymon.txt"
SUMMARY_OUTPUT = "summary.txt"
@ -179,7 +179,7 @@ def main():
# Default benchmark
benchmark = path.join(TOP_DIR, "tests", "html", "perf-rainbow.html")
# Default renderer
renderer = "-c"
renderer = ""
# Default output directory
output_dir = "heartbeat_logs"
# Default build target
@ -199,9 +199,9 @@ def main():
parser.add_argument("-d", "--debug",
action='store_true',
help="Use debug build instead of release build")
parser.add_argument("-g", "--gpu",
parser.add_argument("-w", "--webrender",
action='store_true',
help="Rendering with GPU instead of CPU")
help="Use webrender backend")
parser.add_argument("-l", "--max_layout_threads",
help="Specify the maximum number of threads for layout, for example \"-l 5\"")
parser.add_argument("-o", "--output",
@ -222,8 +222,8 @@ def main():
benchmark = args.benchmark
if args.debug:
build_target = "debug"
if args.gpu:
renderer = "-g"
if args.webrender:
renderer = "-w"
if args.max_layout_threads:
max_layout_threads = int(args.max_layout_threads)
if args.output:

View File

@ -0,0 +1,119 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import os
from os import path
import time
import datetime
import argparse
import subprocess
TOP_DIR = path.join("..", "..")
GUARD_TIME = 20
SUMMARY_OUTPUT = "summary.txt"
def get_command(layout_thread_count, renderer, page, profile):
"""Get the command to execute.
"""
return path.join(TOP_DIR, "mach") + " run --android" + \
" -p %d -o /sdcard/servo/output.png -y %d %s -Z profile-script-events,profile-heartbeats '%s'" % \
(profile, layout_thread_count, renderer, page)
def git_rev_hash():
"""Get the git revision hash.
"""
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).rstrip()
def git_rev_hash_short():
"""Get the git revision short hash.
"""
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).rstrip()
def execute(base_dir, renderer, page, profile, trial, layout_thread_count):
"""Run a single execution.
"""
log_dir = path.join(base_dir, "logs_l" + str(layout_thread_count),
"trial_" + str(trial))
if os.path.exists(log_dir):
print "Log directory already exists: " + log_dir
sys.exit(1)
os.makedirs(log_dir)
# Execute
cmd = get_command(layout_thread_count, renderer, page, profile)
print cmd
os.system(cmd)
print 'sleep ' + str(GUARD_TIME)
time.sleep(GUARD_TIME)
# Write a file that describes this execution
with open(path.join(log_dir, SUMMARY_OUTPUT), "w") as f:
f.write("Datetime (UTC): " + datetime.datetime.utcnow().isoformat())
f.write("\nPlatform: Android")
f.write("\nGit hash: " + git_rev_hash())
f.write("\nGit short hash: " + git_rev_hash_short())
f.write("\nLayout threads: " + str(layout_thread_count))
f.write("\nTrial: " + str(trial))
f.write("\nCommand: " + cmd)
def main():
"""For this script to be useful, the following conditions are needed:
- Build servo for Android in release mode with the "energy-profiling" feature enabled.
"""
# Default number of layout threads
layout_threads = 1
# Default benchmark
benchmark = "https://www.mozilla.org/"
# Default renderer
renderer = ""
# Default output directory
output_dir = "heartbeat_logs"
# Default profile interval
profile = 60
# Parsing the input of the script
parser = argparse.ArgumentParser(description="Characterize Servo timing and energy behavior on Android")
parser.add_argument("-b", "--benchmark",
default=benchmark,
help="Gets the benchmark, for example \"-b http://www.example.com\"")
parser.add_argument("-w", "--webrender",
action='store_true',
help="Use webrender backend")
parser.add_argument("-l", "--layout_threads",
help="Specify the number of threads for layout, for example \"-l 5\"")
parser.add_argument("-o", "--output",
help="Specify the log output directory, for example \"-o heartbeat_logs\"")
parser.add_argument("-p", "--profile",
default=60,
help="Profiler output interval, for example \"-p 60\"")
args = parser.parse_args()
if args.benchmark:
benchmark = args.benchmark
if args.webrender:
renderer = "-w"
if args.layout_threads:
layout_threads = int(args.layout_threads)
if args.output:
output_dir = args.output
if args.profile:
profile = args.profile
if os.path.exists(output_dir):
print "Output directory already exists: " + output_dir
sys.exit(1)
os.makedirs(output_dir)
execute(output_dir, renderer, benchmark, profile, 1, layout_threads)
if __name__ == "__main__":
main()

View File

@ -359,6 +359,8 @@ def main():
directory = 'heartbeat_logs'
# Default output directory
output_dir = 'plots'
# Default android
android = False
# Parsing the input of the script
parser = argparse.ArgumentParser(description="Process Heartbeat log files from characterization")
@ -368,12 +370,19 @@ def main():
parser.add_argument("-o", "--output",
default=output_dir,
help="Specify the log output directory, for example \"-o plots\"")
parser.add_argument("--android",
action="store_true",
dest="android",
default=False,
help="Specify if processing results from Android")
args = parser.parse_args()
if args.directory:
directory = args.directory
if args.output:
output_dir = args.output
if args.android:
android = args.android
if not os.path.exists(directory):
print "Input directory does not exist: " + directory
@ -385,6 +394,7 @@ def main():
res = process_logs(directory)
if not android:
best = find_best_executions(directory)
print 'Best time:', best[0]
print 'Best energy:', best[1]