[ui] Fix eslint issues (`ui/eslint-all --fix`)
Change-Id: Idaa87c4d126af606d45c326d1a7d73341a0557c1
diff --git a/ui/src/controller/flamegraph_controller.ts b/ui/src/controller/flamegraph_controller.ts
index 62648df..e856d72 100644
--- a/ui/src/controller/flamegraph_controller.ts
+++ b/ui/src/controller/flamegraph_controller.ts
@@ -53,18 +53,18 @@
function getFlamegraphType(type: ProfileType) {
switch (type) {
- case ProfileType.HEAP_PROFILE:
- case ProfileType.MIXED_HEAP_PROFILE:
- case ProfileType.NATIVE_HEAP_PROFILE:
- case ProfileType.JAVA_HEAP_SAMPLES:
- return 'native';
- case ProfileType.JAVA_HEAP_GRAPH:
- return 'graph';
- case ProfileType.PERF_SAMPLE:
- return 'perf';
- default:
- const exhaustiveCheck: never = type;
- throw new Error(`Unhandled case: ${exhaustiveCheck}`);
+ case ProfileType.HEAP_PROFILE:
+ case ProfileType.MIXED_HEAP_PROFILE:
+ case ProfileType.NATIVE_HEAP_PROFILE:
+ case ProfileType.JAVA_HEAP_SAMPLES:
+ return 'native';
+ case ProfileType.JAVA_HEAP_GRAPH:
+ return 'graph';
+ case ProfileType.PERF_SAMPLE:
+ return 'perf';
+ default:
+ const exhaustiveCheck: never = type;
+ throw new Error(`Unhandled case: ${exhaustiveCheck}`);
}
}
@@ -100,7 +100,7 @@
}
tableName = `${this.prefix}_${this.tableId++}`;
await this.engine.query(
- `create temp table if not exists ${tableName} as ${query}`);
+ `create temp table if not exists ${tableName} as ${query}`);
this.cache.set(query, tableName);
}
return tableName;
@@ -128,7 +128,7 @@
const upids = [];
if (!area) {
this.checkCompletionAndPublishFlamegraph(
- {...globals.flamegraphDetails, isInAreaSelection: false});
+ {...globals.flamegraphDetails, isInAreaSelection: false});
return;
}
for (const trackId of area.tracks) {
@@ -142,7 +142,7 @@
}
if (upids.length === 0) {
this.checkCompletionAndPublishFlamegraph(
- {...globals.flamegraphDetails, isInAreaSelection: false});
+ {...globals.flamegraphDetails, isInAreaSelection: false});
return;
}
globals.dispatch(Actions.openFlamegraph({
@@ -167,13 +167,13 @@
}
private async assembleFlamegraphDetails(
- selection: FlamegraphState, isInAreaSelection: boolean) {
+ selection: FlamegraphState, isInAreaSelection: boolean) {
const selectedFlamegraphState = {...selection};
const flamegraphMetadata = await this.getFlamegraphMetadata(
- selection.type,
- selectedFlamegraphState.start,
- selectedFlamegraphState.end,
- selectedFlamegraphState.upids);
+ selection.type,
+ selectedFlamegraphState.start,
+ selectedFlamegraphState.end,
+ selectedFlamegraphState.upids);
if (flamegraphMetadata !== undefined) {
Object.assign(this.flamegraphDetails, flamegraphMetadata);
}
@@ -187,28 +187,28 @@
this.lastSelectedFlamegraphState = {...selection};
const expandedId = selectedFlamegraphState.expandedCallsite ?
- selectedFlamegraphState.expandedCallsite.id :
- -1;
+ selectedFlamegraphState.expandedCallsite.id :
+ -1;
const rootSize = selectedFlamegraphState.expandedCallsite === undefined ?
- undefined :
- selectedFlamegraphState.expandedCallsite.totalSize;
+ undefined :
+ selectedFlamegraphState.expandedCallsite.totalSize;
const key = `${selectedFlamegraphState.upids};${
- selectedFlamegraphState.start};${selectedFlamegraphState.end}`;
+ selectedFlamegraphState.start};${selectedFlamegraphState.end}`;
try {
const flamegraphData = await this.getFlamegraphData(
- key,
- /* eslint-disable @typescript-eslint/strict-boolean-expressions */
- selectedFlamegraphState.viewingOption ?
- /* eslint-enable */
- selectedFlamegraphState.viewingOption :
- defaultViewingOption(selectedFlamegraphState.type),
- selection.start,
- selection.end,
- selectedFlamegraphState.upids,
- selectedFlamegraphState.type,
- selectedFlamegraphState.focusRegex);
+ key,
+ /* eslint-disable @typescript-eslint/strict-boolean-expressions */
+ selectedFlamegraphState.viewingOption ?
+ /* eslint-enable */
+ selectedFlamegraphState.viewingOption :
+ defaultViewingOption(selectedFlamegraphState.type),
+ selection.start,
+ selection.end,
+ selectedFlamegraphState.upids,
+ selectedFlamegraphState.type,
+ selectedFlamegraphState.focusRegex);
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (flamegraphData !== undefined && selection &&
selection.kind === selectedFlamegraphState.kind &&
@@ -217,11 +217,11 @@
const expandedFlamegraphData =
expandCallsites(flamegraphData, expandedId);
this.prepareAndMergeCallsites(
- expandedFlamegraphData,
- this.lastSelectedFlamegraphState.viewingOption,
- isInAreaSelection,
- rootSize,
- this.lastSelectedFlamegraphState.expandedCallsite);
+ expandedFlamegraphData,
+ this.lastSelectedFlamegraphState.viewingOption,
+ isInAreaSelection,
+ rootSize,
+ this.lastSelectedFlamegraphState.expandedCallsite);
}
} finally {
this.requestingData = false;
@@ -239,7 +239,7 @@
this.lastSelectedFlamegraphState.end !== selection.end ||
this.lastSelectedFlamegraphState.type !== selection.type ||
!FlamegraphController.areArraysEqual(
- this.lastSelectedFlamegraphState.upids, selection.upids) ||
+ this.lastSelectedFlamegraphState.upids, selection.upids) ||
this.lastSelectedFlamegraphState.viewingOption !==
selection.viewingOption ||
this.lastSelectedFlamegraphState.focusRegex !==
@@ -249,11 +249,11 @@
}
private prepareAndMergeCallsites(
- flamegraphData: CallsiteInfo[],
- viewingOption: FlamegraphStateViewingOption, isInAreaSelection: boolean,
- rootSize?: number, expandedCallsite?: CallsiteInfo) {
+ flamegraphData: CallsiteInfo[],
+ viewingOption: FlamegraphStateViewingOption, isInAreaSelection: boolean,
+ rootSize?: number, expandedCallsite?: CallsiteInfo) {
this.flamegraphDetails.flamegraph = mergeCallsites(
- flamegraphData, this.getMinSizeDisplayed(flamegraphData, rootSize));
+ flamegraphData, this.getMinSizeDisplayed(flamegraphData, rootSize));
this.flamegraphDetails.expandedCallsite = expandedCallsite;
this.flamegraphDetails.viewingOption = viewingOption;
this.flamegraphDetails.isInAreaSelection = isInAreaSelection;
@@ -265,15 +265,15 @@
flamegraphDetails.graphIncomplete =
(await this.args.engine.query(`select value from stats
where severity = 'error' and name = 'heap_graph_non_finalized_graph'`))
- .firstRow({value: NUM})
- .value > 0;
+ .firstRow({value: NUM})
+ .value > 0;
publishFlamegraphDetails(flamegraphDetails);
}
async getFlamegraphData(
- baseKey: string, viewingOption: FlamegraphStateViewingOption, start: time,
- end: time, upids: number[], type: ProfileType,
- focusRegex: string): Promise<CallsiteInfo[]> {
+ baseKey: string, viewingOption: FlamegraphStateViewingOption, start: time,
+ end: time, upids: number[], type: ProfileType,
+ focusRegex: string): Promise<CallsiteInfo[]> {
let currentData: CallsiteInfo[];
const key = `${baseKey}-${viewingOption}`;
if (this.flamegraphDatasets.has(key)) {
@@ -287,15 +287,15 @@
const tableName =
await this.prepareViewsAndTables(start, end, upids, type, focusRegex);
currentData = await this.getFlamegraphDataFromTables(
- tableName, viewingOption, focusRegex);
+ tableName, viewingOption, focusRegex);
this.flamegraphDatasets.set(key, currentData);
}
return currentData;
}
async getFlamegraphDataFromTables(
- tableName: string, viewingOption: FlamegraphStateViewingOption,
- focusRegex: string) {
+ tableName: string, viewingOption: FlamegraphStateViewingOption,
+ focusRegex: string) {
let orderBy = '';
let totalColumnName: 'cumulativeSize'|'cumulativeAllocSize'|
'cumulativeCount'|'cumulativeAllocCount' = 'cumulativeSize';
@@ -304,39 +304,39 @@
// Alternatively consider collapsing frames of the same label.
const maxDepth = 100;
switch (viewingOption) {
- case FlamegraphStateViewingOption.ALLOC_SPACE_MEMORY_ALLOCATED_KEY:
- orderBy = `where cumulative_alloc_size > 0 and depth < ${
- maxDepth} order by depth, parent_id,
+ case FlamegraphStateViewingOption.ALLOC_SPACE_MEMORY_ALLOCATED_KEY:
+ orderBy = `where cumulative_alloc_size > 0 and depth < ${
+ maxDepth} order by depth, parent_id,
cumulative_alloc_size desc, name`;
- totalColumnName = 'cumulativeAllocSize';
- selfColumnName = 'size';
- break;
- case FlamegraphStateViewingOption.OBJECTS_ALLOCATED_NOT_FREED_KEY:
- orderBy = `where cumulative_count > 0 and depth < ${
- maxDepth} order by depth, parent_id,
+ totalColumnName = 'cumulativeAllocSize';
+ selfColumnName = 'size';
+ break;
+ case FlamegraphStateViewingOption.OBJECTS_ALLOCATED_NOT_FREED_KEY:
+ orderBy = `where cumulative_count > 0 and depth < ${
+ maxDepth} order by depth, parent_id,
cumulative_count desc, name`;
- totalColumnName = 'cumulativeCount';
- selfColumnName = 'count';
- break;
- case FlamegraphStateViewingOption.OBJECTS_ALLOCATED_KEY:
- orderBy = `where cumulative_alloc_count > 0 and depth < ${
- maxDepth} order by depth, parent_id,
+ totalColumnName = 'cumulativeCount';
+ selfColumnName = 'count';
+ break;
+ case FlamegraphStateViewingOption.OBJECTS_ALLOCATED_KEY:
+ orderBy = `where cumulative_alloc_count > 0 and depth < ${
+ maxDepth} order by depth, parent_id,
cumulative_alloc_count desc, name`;
- totalColumnName = 'cumulativeAllocCount';
- selfColumnName = 'count';
- break;
- case FlamegraphStateViewingOption.PERF_SAMPLES_KEY:
- case FlamegraphStateViewingOption.SPACE_MEMORY_ALLOCATED_NOT_FREED_KEY:
- orderBy = `where cumulative_size > 0 and depth < ${
- maxDepth} order by depth, parent_id,
+ totalColumnName = 'cumulativeAllocCount';
+ selfColumnName = 'count';
+ break;
+ case FlamegraphStateViewingOption.PERF_SAMPLES_KEY:
+ case FlamegraphStateViewingOption.SPACE_MEMORY_ALLOCATED_NOT_FREED_KEY:
+ orderBy = `where cumulative_size > 0 and depth < ${
+ maxDepth} order by depth, parent_id,
cumulative_size desc, name`;
- totalColumnName = 'cumulativeSize';
- selfColumnName = 'size';
- break;
- default:
- const exhaustiveCheck: never = viewingOption;
- throw new Error(`Unhandled case: ${exhaustiveCheck}`);
- break;
+ totalColumnName = 'cumulativeSize';
+ selfColumnName = 'size';
+ break;
+ default:
+ const exhaustiveCheck: never = viewingOption;
+ throw new Error(`Unhandled case: ${exhaustiveCheck}`);
+ break;
}
const callsites = await this.args.engine.query(`
@@ -419,8 +419,8 @@
}
private async prepareViewsAndTables(
- start: time, end: time, upids: number[], type: ProfileType,
- focusRegex: string): Promise<string> {
+ start: time, end: time, upids: number[], type: ProfileType,
+ focusRegex: string): Promise<string> {
const flamegraphType = getFlamegraphType(type);
if (type === ProfileType.PERF_SAMPLE) {
let upid: string;
@@ -433,7 +433,7 @@
upidGroup = `NULL`;
}
return this.cache.getTableName(
- `select id, name, map_name, parent_id, depth, cumulative_size,
+ `select id, name, map_name, parent_id, depth, cumulative_size,
cumulative_alloc_size, cumulative_count, cumulative_alloc_count,
size, alloc_size, count, alloc_count, source_file, line_number
from experimental_flamegraph(
@@ -446,7 +446,7 @@
)`);
}
return this.cache.getTableName(
- `select id, name, map_name, parent_id, depth, cumulative_size,
+ `select id, name, map_name, parent_id, depth, cumulative_size,
cumulative_alloc_size, cumulative_count, cumulative_alloc_count,
size, alloc_size, count, alloc_count, source_file, line_number
from experimental_flamegraph(
@@ -474,14 +474,14 @@
}
async getFlamegraphMetadata(
- type: ProfileType, start: time, end: time,
- upids: number[]): Promise<FlamegraphDetails|undefined> {
+ type: ProfileType, start: time, end: time,
+ upids: number[]): Promise<FlamegraphDetails|undefined> {
// Don't do anything if selection of the marker stayed the same.
if ((this.lastSelectedFlamegraphState !== undefined &&
((this.lastSelectedFlamegraphState.start === start &&
this.lastSelectedFlamegraphState.end === end &&
FlamegraphController.areArraysEqual(
- this.lastSelectedFlamegraphState.upids, upids))))) {
+ this.lastSelectedFlamegraphState.upids, upids))))) {
return undefined;
}
@@ -490,7 +490,7 @@
const upidGroup = FlamegraphController.serializeUpidGroup(upids);
const result = await this.args.engine.query(
- `select pid from process where upid in (${upidGroup})`);
+ `select pid from process where upid in (${upidGroup})`);
const it = result.iter({pid: NUM});
const pids = [];
for (let i = 0; it.valid(); ++i, it.next()) {