Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #29 from atom/wl-window-timings
Browse files Browse the repository at this point in the history
Only show project load times when a project is deserialized
  • Loading branch information
Wliu authored Nov 4, 2017
2 parents 57b44ef + b0b82c3 commit acfddff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
35 changes: 14 additions & 21 deletions lib/window-panel-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ export default class WindowPanelView {
etch.initialize(this)

this.disposables = new CompositeDisposable()
this.disposables.add(atom.tooltips.add(this.refs.windowTiming, {title: 'The time taken to load this window'}))
this.disposables.add(atom.tooltips.add(this.refs.shellTiming, {title: 'The time taken to launch the app'}))
this.disposables.add(atom.tooltips.add(this.refs.workspaceTiming, {title: 'The time taken to rebuild the previously opened editors'}))
this.disposables.add(atom.tooltips.add(this.refs.windowTiming, {title: 'The time taken to load this window'}))
this.disposables.add(atom.tooltips.add(this.refs.projectTiming, {title: 'The time taken to rebuild the previously opened buffers'}))
this.disposables.add(atom.tooltips.add(this.refs.atomTiming, {title: 'The time taken to read and parse the stored window state'}))
this.disposables.add(atom.tooltips.add(this.refs.workspaceTiming, {title: 'The time taken to rebuild the previously opened editors'}))
}

update () {}
Expand All @@ -29,30 +28,25 @@ export default class WindowPanelView {
<div className='inset-panel'>
<div className='panel-heading'>Startup Time</div>
<div className='panel-body padded'>
<div className='timing' ref='windowTiming'>
<span className='inline-block'>Window load time</span>
<span className='inline-block' ref='windowLoadTime'>Loading…</span>
</div>

<div className='timing' ref='shellTiming'>
<span className='inline-block'>Shell load time</span>
<span className='inline-block' ref='shellLoadTime'>Loading…</span>
</div>

<div ref='deserializeTimings'>
<div className='timing' ref='workspaceTiming'>
<span className='inline-block'>Workspace load time</span>
<span className='inline-block' ref='workspaceLoadTime'>Loading…</span>
</div>
<div className='timing' ref='windowTiming'>
<span className='inline-block'>Window load time</span>
<span className='inline-block' ref='windowLoadTime'>Loading…</span>
</div>

<div ref='deserializeTimings'>
<div className='timing' ref='projectTiming'>
<span className='inline-block'>Project load time</span>
<span className='inline-block' ref='projectLoadTime'>Loading…</span>
</div>

<div className='timing' ref='atomTiming'>
<span className='inline-block'>Window state load time</span>
<span className='inline-block' ref='atomLoadTime'>Loading…</span>
<div className='timing' ref='workspaceTiming'>
<span className='inline-block'>Workspace load time</span>
<span className='inline-block' ref='workspaceLoadTime'>Loading…</span>
</div>
</div>
</div>
Expand All @@ -74,13 +68,12 @@ export default class WindowPanelView {
this.refs.shellTiming.style.display = 'none'
}

if (atom.deserializeTimings != null) {
this.refs.workspaceLoadTime.classList.add(this.getHighlightClass(atom.deserializeTimings.workspace))
this.refs.workspaceLoadTime.textContent = `${atom.deserializeTimings.workspace}ms`
if (atom.deserializeTimings.project != null) {
// Project and workspace timings only exist if the current project was previously opened
this.refs.projectLoadTime.classList.add(this.getHighlightClass(atom.deserializeTimings.project))
this.refs.projectLoadTime.textContent = `${atom.deserializeTimings.project}ms`
this.refs.atomLoadTime.classList.add(this.getHighlightClass(atom.deserializeTimings.atom))
this.refs.atomLoadTime.textContent = `${atom.deserializeTimings.atom}ms`
this.refs.workspaceLoadTime.classList.add(this.getHighlightClass(atom.deserializeTimings.workspace))
this.refs.workspaceLoadTime.textContent = `${atom.deserializeTimings.workspace}ms`
} else {
this.refs.deserializeTimings.style.display = 'none'
}
Expand Down
5 changes: 0 additions & 5 deletions spec/timecop-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ const CSON = require(path.join(atom.getLoadSettings().resourcePath, 'node_module
const {it, fit, ffit, beforeEach, afterEach} = require('./async-spec-helpers') // eslint-disable-line no-unused-vars

describe('Timecop', () => {
let workspaceElement = null

beforeEach(async () => {
workspaceElement = atom.views.getView(atom.workspace)
jasmine.attachToDOM(workspaceElement)

spyOn(CompileCache, 'getCacheStats').andReturn({
'.js': {hits: 3, misses: 4},
'.ts': {hits: 5, misses: 6},
Expand Down

0 comments on commit acfddff

Please sign in to comment.