From d957f8ebc24bcbdb94c0c5297c0072aa8d2ebec8 Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Mon, 24 Sep 2018 23:58:18 -0400 Subject: Add syscall count benchmark for 002_hello.ts (#820) * Add syscall count tracking for benchmark * Add fetch_deps thread benchmark * Switch to `strace -c` for syscall parsing * Spawn http_server during benchmark (for fetch) * Rename `benchmarks` to `exec_time_benchmarks` * Update app_test.js --- website/app.js | 28 +++++++++++++++++++++++++++- website/app_test.js | 30 +++++++++++++++++++++++++----- website/index.html | 2 ++ 3 files changed, 54 insertions(+), 6 deletions(-) (limited to 'website') diff --git a/website/app.js b/website/app.js index 27baa1958..ba8dbac36 100644 --- a/website/app.js +++ b/website/app.js @@ -20,7 +20,7 @@ export function createBinarySizeColumns(data) { return [["binary_size", ...data.map(d => d.binary_size || 0)]]; } -const threadCountNames = ["set_timeout"]; +const threadCountNames = ["set_timeout", "fetch_deps"]; export function createThreadCountColumns(data) { return threadCountNames.map(name => [ name, @@ -34,6 +34,20 @@ export function createThreadCountColumns(data) { ]); } +const syscallCountNames = ["hello"]; +export function createSyscallCountColumns(data) { + return syscallCountNames.map(name => [ + name, + ...data.map(d => { + const syscallCountData = d["syscall_count"]; + if (!syscallCountData) { + return 0; + } + return syscallCountData[name] || 0; + }) + ]); +} + export function createSha1List(data) { return data.map(d => d.sha1); } @@ -55,6 +69,7 @@ export async function main() { const execTimeColumns = createExecTimeColumns(data); const binarySizeColumns = createBinarySizeColumns(data); const threadCountColumns = createThreadCountColumns(data); + const syscallCountColumns = createSyscallCountColumns(data); const sha1List = createSha1List(data); c3.generate({ @@ -94,4 +109,15 @@ export async function main() { } } }); + + c3.generate({ + bindto: "#syscall-count-chart", + data: { columns: syscallCountColumns }, + axis: { + x: { + type: "category", + categories: sha1List + } + } + }); } diff --git a/website/app_test.js b/website/app_test.js index 5fca1e44c..48b7f2859 100644 --- a/website/app_test.js +++ b/website/app_test.js @@ -5,6 +5,7 @@ import { createBinarySizeColumns, createExecTimeColumns, createThreadCountColumns, + createSyscallCountColumns, createSha1List, formatBytes } from "./app.js"; @@ -23,7 +24,11 @@ const regularData = [ } }, thread_count: { - set_timeout: 4 + set_timeout: 4, + fetch_deps: 6 + }, + syscall_count: { + hello: 600 } }, { @@ -39,7 +44,11 @@ const regularData = [ } }, thread_count: { - set_timeout: 5 + set_timeout: 5, + fetch_deps: 7 + }, + syscall_count: { + hello: 700 } } ]; @@ -52,7 +61,8 @@ const irregularData = [ hello: {}, relative_import: {} }, - thread_count: {} + thread_count: {}, + syscall_count: {} }, { created_at: "2018-02-01T01:00:00Z", @@ -86,12 +96,22 @@ test(function createBinarySizeColumnsIrregularData() { test(function createThreadCountColumnsRegularData() { const columns = createThreadCountColumns(regularData); - assertEqual(columns, [["set_timeout", 4, 5]]); + assertEqual(columns, [["set_timeout", 4, 5], ["fetch_deps", 6, 7]]); }); test(function createThreadCountColumnsIrregularData() { const columns = createThreadCountColumns(irregularData); - assertEqual(columns, [["set_timeout", 0, 0]]); + assertEqual(columns, [["set_timeout", 0, 0], ["fetch_deps", 0, 0]]); +}); + +test(function createSyscallCountColumnsRegularData() { + const columns = createSyscallCountColumns(regularData); + assertEqual(columns, [["hello", 600, 700]]); +}); + +test(function createSyscallCountColumnsIrregularData() { + const columns = createSyscallCountColumns(irregularData); + assertEqual(columns, [["hello", 0, 0]]); }); test(function createSha1ListRegularData() { diff --git a/website/index.html b/website/index.html index 96d1afd7f..3871763ac 100644 --- a/website/index.html +++ b/website/index.html @@ -11,6 +11,8 @@

Thread count chart

+

Syscall count chart

+