Add a "Run Benchmarks" command to plot benchmark results

This commit is contained in:
Antonio Scandurra 2016-10-13 19:52:02 +02:00
parent 1bdd79d719
commit 5211b49f7d
5 changed files with 14 additions and 6 deletions

View File

@ -147,6 +147,7 @@
{ label: 'Open In Dev Mode…', command: 'application:open-dev' }
{ label: 'Reload Window', command: 'window:reload' }
{ label: 'Run Package Specs', command: 'window:run-package-specs' }
{ label: 'Run Benchmarks', command: 'window:run-benchmarks' }
{ label: 'Toggle Developer Tools', command: 'window:toggle-dev-tools' }
]
}

View File

@ -20,11 +20,6 @@ export default function () {
document.title = 'Benchmarks'
window.addEventListener('keydown', (event) => {
// Quit: cmd-q / ctrl-q
if ((event.metaKey || event.ctrlKey) && event.keyCode === 81) {
ipcRenderer.send('command', 'application:quit')
}
// Reload: cmd-r / ctrl-r
if ((event.metaKey || event.ctrlKey) && event.keyCode === 82) {
ipcHelpers.call('window-method', 'reload')
@ -59,7 +54,6 @@ export default function () {
})
// Prevent benchmarks from modifying application menus
global.atom.menu.update()
global.atom.menu.sendToBrowserProcess = function () { }
if (headless) {

View File

@ -300,6 +300,9 @@ class AtomApplication
@disposable.add ipcHelpers.on ipcMain, 'run-package-specs', (event, packageSpecPath) =>
@runTests({resourcePath: @devResourcePath, pathsToOpen: [packageSpecPath], headless: false})
@disposable.add ipcHelpers.on ipcMain, 'run-benchmarks', (event, benchmarksPath) =>
@runBenchmarks({resourcePath: @devResourcePath, pathsToOpen: [benchmarksPath], headless: false, test: false})
@disposable.add ipcHelpers.on ipcMain, 'command', (event, command) =>
@emit(command)

View File

@ -54,6 +54,7 @@ module.exports = ({commandRegistry, commandInstaller, config, notificationManage
'application:open-your-stylesheet': -> ipcRenderer.send('command', 'application:open-your-stylesheet')
'application:open-license': -> @getModel().openLicense()
'window:run-package-specs': -> @runPackageSpecs()
'window:run-benchmarks': -> @runBenchmarks()
'window:focus-next-pane': -> @getModel().activateNextPane()
'window:focus-previous-pane': -> @getModel().activatePreviousPane()
'window:focus-pane-above': -> @focusPaneViewAbove()

View File

@ -142,4 +142,13 @@ class WorkspaceElement extends HTMLElement
ipcRenderer.send('run-package-specs', specPath)
runBenchmarks: ->
if activePath = @workspace.getActivePaneItem()?.getPath?()
[projectPath] = @project.relativizePath(activePath)
else
[projectPath] = @project.getPaths()
if projectPath
ipcRenderer.send('run-benchmarks', path.join(projectPath, 'benchmarks'))
module.exports = WorkspaceElement = document.registerElement 'atom-workspace', prototype: WorkspaceElement.prototype