Skip to content

Commit

Permalink
write profile to disk and log filename, #60332
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 22, 2018
1 parent 3dded63 commit 1fae869
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { ILogService } from 'vs/platform/log/common/log';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { onUnexpectedError } from 'vs/base/common/errors';
import { tmpdir } from 'os';
import { join } from 'path';
import { writeFile } from 'vs/base/node/pfs';

export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchContribution {

Expand Down Expand Up @@ -106,12 +109,15 @@ export class ExtensionsAutoProfiler extends Disposable implements IWorkbenchCont
}
}

this._extensionService.getExtension(top.id).then(extension => {
this._extensionService.getExtension(top.id).then(async extension => {
if (!extension) {
return;
}

this._logService.warn(`UNRESPONSIVE extension host, '${top ? top.id : 'unknown'}' took ${top ? top.percentage : 'unknown'}% of ${duration / 1e3}ms`, data);
const path = join(tmpdir(), `exthost-${Math.random().toString(16).slice(2, 8)}.cpuprofile`);
await writeFile(path, JSON.stringify(profile.data));

this._logService.warn(`UNRESPONSIVE extension host, '${top ? top.id : 'unknown'}' took ${top ? top.percentage : 'unknown'}% of ${duration / 1e3}ms, saved PROFILE here: '${path}'`, data);

/* __GDPR__
"exthostunresponsive" : {
Expand Down

0 comments on commit 1fae869

Please sign in to comment.