Remove more perf and timing stuff

This commit is contained in:
Ben Gotow 2017-06-23 16:30:28 -07:00
parent 799ccce640
commit a9a57de215
9 changed files with 0 additions and 146 deletions

View file

@ -48,19 +48,6 @@ class ComposerWithWindowProps extends React.Component {
_onDraftReady = () => {
this.refs.composer.focus().then(() => {
if (NylasEnv.timer.isPending('open-composer-window')) {
const actionTimeMs = NylasEnv.timer.stop('open-composer-window');
if (actionTimeMs && actionTimeMs <= 4000) {
Actions.recordUserEvent("Composer Popout Timed", {timeInMs: actionTimeMs})
}
// TODO time when plugins actually get loaded in
Actions.recordPerfMetric({
action: 'open-composer-window',
actionTimeMs,
maxValue: 4000,
sample: 0.9,
})
}
NylasEnv.displayWindow();
if (this.state.errorMessage) {

View file

@ -51,10 +51,6 @@ export default class AccountErrorNotification extends React.Component {
}
_onCheckAgain(event, account) {
if (event.metaKey) {
Actions.debugSync()
return
}
clearTimeout(this._checkingTimeout)
this.setState({checking: true})
this._checkingTimeout = setTimeout(() => this.setState({checking: false}), 10000)

View file

@ -9,7 +9,6 @@ import path from 'path';
import proc from 'child_process'
import {EventEmitter} from 'events';
import GlobalTimer from './global-timer'
import WindowManager from './window-manager';
import FileListCache from './file-list-cache';
import DatabaseReader from './database-reader';

View file

@ -1,73 +0,0 @@
import Utils from '../../src/flux/models/utils'
const BUFFER_SIZE = 100;
/**
* A benchmarking system to keep track of start and end times for various
* event types.
*/
export default class GlobalTimer {
constructor() {
this._doneRuns = {}
this._pendingRuns = {}
}
start(key) {
if (!this._pendingRuns[key]) {
this._pendingRuns[key] = [Date.now()]
}
}
/**
* This will add split points in an ongoing run (or do nothing if no run
* has started). Useful for fine-grained debugging of long timers.
*/
split(key) {
if (!this._pendingRuns[key]) { return {} }
this._pendingRuns[key].push(Date.now())
return {
split: this.calcSplit(this._pendingRuns[key]),
total: this.calcTotal(this._pendingRuns[key]),
}
}
stop(key) {
if (!this._pendingRuns[key]) { return 0 }
if (!this._doneRuns[key]) { this._doneRuns[key] = [] }
this._pendingRuns[key].push(Date.now());
const total = this.calcTotal(this._pendingRuns[key])
this._doneRuns[key].push(this._pendingRuns[key])
if (this._doneRuns[key].length > BUFFER_SIZE) {
this._doneRuns[key].shift()
}
delete this._pendingRuns[key]
return total
}
calcSplit(curRun) {
return curRun[curRun.length - 1] - curRun[curRun.length - 2]
}
calcTotal(curRun) {
return curRun[curRun.length - 1] - curRun[0]
}
calcMean(key) {
return Utils.mean(this.totals(key))
}
calcStdev(key) {
return Utils.stdev(this.totals(key))
}
totals(key) {
return this._doneRuns[key].map(this.calcTotal)
}
runsFor(key) {
return this._doneRuns[key]
}
clear(key) {
delete this._doneRuns[key]
}
}

View file

@ -511,7 +511,6 @@ class Actions {
Public: Publish a user event to any analytics services linked to N1.
*/
static recordUserEvent = ActionScopeWorkWindow;
static recordPerfMetric = ActionScopeWorkWindow;
static addMailRule = ActionScopeWindow;
static reorderMailRule = ActionScopeWindow;
@ -554,8 +553,6 @@ class Actions {
static expandInitialSyncState = ActionScopeWindow;
static resetEmailCache = ActionScopeGlobal;
static debugSync = ActionScopeGlobal;
}

View file

@ -275,7 +275,6 @@ class DraftStore extends NylasStore {
_onPopoutBlankDraft = () => {
Actions.recordUserEvent("Draft Created", {type: "new"});
NylasEnv.timer.start('open-composer-window');
return DraftFactory.createDraft().then((draft) => {
return this._finalizeAndPersistNewMessage(draft).then(({draftClientId}) => {
return this._onPopoutDraftClientId(draftClientId, {newDraft: true});
@ -287,8 +286,6 @@ class DraftStore extends NylasStore {
if (draftClientId == null) {
throw new Error("DraftStore::onPopoutDraftId - You must provide a draftClientId");
}
NylasEnv.timer.start('open-composer-window');
const title = options.newDraft ? "New Message" : "Message";
return this.sessionForClientId(draftClientId).then((session) => {
return session.changes.commit().then(() => {

View file

@ -101,16 +101,7 @@ export class Download {
let startRequest = null;
const before = Date.now();
const onFailed = (err) => {
Actions.recordPerfMetric({
action: 'file-download',
accountId: this.accountId,
actionTimeMs: Date.now() - before,
maxValue: 10 * 60 * 1000,
succeeded: false,
})
this.request = null;
stream.end();
if (!this.retryWithBackoff || this.attempts >= this.maxAttempts) {
@ -127,13 +118,6 @@ export class Download {
};
const onSuccess = () => {
Actions.recordPerfMetric({
action: 'file-download',
accountId: this.accountId,
actionTimeMs: Date.now() - before,
maxValue: 10 * 60 * 1000,
succeeded: true,
})
this.request = null;
stream.end();
this.state = State.Finished;

View file

@ -199,38 +199,10 @@ export default class SendDraftTask extends BaseDraftTask {
if (this.playSound && NylasEnv.config.get("core.sending.sounds")) {
SoundRegistry.playSound('send');
}
<<<<<<< HEAD
if (NylasEnv.timer.isPending(this._timerKey)) {
const account = AccountStore.accountForId(this.draft.accountId)
const provider = account ? account.provider : 'Unknown provider'
Actions.recordPerfMetric({
provider,
action: 'send-draft',
actionTimeMs: NylasEnv.timer.stop(this._timerKey),
maxValue: 60 * 1000,
succeeded: true,
})
}
=======
>>>>>>> parent of ae9aede30... [client-app] Measure and report sending times
return Promise.resolve(Task.Status.Success);
}
onError = (err) => {
<<<<<<< HEAD
if (NylasEnv.timer.isPending(this._timerKey)) {
const account = AccountStore.accountForId(this.draft.accountId)
const provider = account ? account.provider : 'Unknown provider'
Actions.recordPerfMetric({
provider,
action: 'send-draft',
actionTimeMs: NylasEnv.timer.stop(this._timerKey),
maxValue: 60 * 1000,
succeeded: false,
})
}
=======
>>>>>>> parent of ae9aede30... [client-app] Measure and report sending times
if (err instanceof BaseDraftTask.DraftNotFoundError) {
return Promise.resolve(Task.Status.Continue);
}

View file

@ -225,8 +225,6 @@ export default class NylasEnvConstructor {
this.packages.onDidActivateInitialPackages(() => this.watchThemes());
this.windowEventHandler = new WindowEventHandler();
this.timer = remote.getGlobal('application').timer;
this.globalWindowEmitter = new Emitter();
if (!this.inSpecMode()) {
@ -933,9 +931,6 @@ export default class NylasEnvConstructor {
// This also means that the windowType has changed and a different set of
// plugins needs to be loaded.
populateHotWindow(event, loadSettings) {
if (/composer/.test(loadSettings.windowType)) {
NylasEnv.timer.split("Popout Draft");
}
this.loadSettings = loadSettings;
this.constructor.loadSettings = loadSettings;