Permalink
Browse files

remove the old heap profiler visualization code

Differential Revision: D4650983

fbshipit-source-id: 1f791acdd3e2d96e7881ea037045fafa2c6d781a
  • Loading branch information...
cwdick authored and facebook-github-bot committed Mar 15, 2017
1 parent 7098c45 commit af590b0c747e096d7a7856e88380307d81142f84
Showing with 0 additions and 2,814 deletions.
  1. +0 −3 local-cli/server/middleware/heapCapture/.gitignore
  2. +0 −8 local-cli/server/middleware/heapCapture/Makefile
  3. +0 −12 local-cli/server/middleware/heapCapture/heapCapture.html
  4. +0 −21 local-cli/server/middleware/heapCapture/package.json
  5. +0 −190 local-cli/server/middleware/heapCapture/src/Aggrow.js
  6. +0 −216 local-cli/server/middleware/heapCapture/src/AggrowData.js
  7. +0 −694 local-cli/server/middleware/heapCapture/src/AggrowExpander.js
  8. +0 −439 local-cli/server/middleware/heapCapture/src/AggrowTable.jsx
  9. +0 −42 local-cli/server/middleware/heapCapture/src/DataColumnSelector.jsx
  10. +0 −26 local-cli/server/middleware/heapCapture/src/Draggable.jsx
  11. +0 −33 local-cli/server/middleware/heapCapture/src/DropTarget.jsx
  12. +0 −29 local-cli/server/middleware/heapCapture/src/ExpanderConfiguration.jsx
  13. +0 −152 local-cli/server/middleware/heapCapture/src/StackExpanderCreator.jsx
  14. +0 −96 local-cli/server/middleware/heapCapture/src/StackRegistry.js
  15. +0 −26 local-cli/server/middleware/heapCapture/src/StringInterner.js
  16. +0 −86 local-cli/server/middleware/heapCapture/src/TableConfiguration.jsx
  17. +0 −103 local-cli/server/middleware/heapCapture/src/TableHeader.jsx
  18. +0 −412 local-cli/server/middleware/heapCapture/src/heapCapture.js
  19. +0 −24 local-cli/server/middleware/heapCapture/src/index.js
  20. +0 −29 local-cli/server/middleware/heapCapture/webpack.config.js
  21. +0 −171 local-cli/server/middleware/heapCaptureMiddleware.js
  22. +0 −2 local-cli/server/runServer.js
@@ -1,3 +0,0 @@
/captures/*
preLoadedCapture.js
bundle.js
@@ -1,8 +0,0 @@
SHELL := /bin/bash
all:
NODE_PATH="../../../../node_modules/" babel --presets babel-preset-react-native --source-maps inline -d out src
for f in out/*.js; do echo -e "\n// @generated" >> $$f; done
watch:
NODE_PATH="../../../../node_modules/" babel --watch --presets babel-preset-react-native -d out src
@@ -1,12 +0,0 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%;">
<head>
<meta charset="utf-8">
<title>JSC Heap Capture</title>
</head>
<body style="margin:0px; height: 100%">
Loading... This could take a while depending on how big the profile is. Check devtools console for errors.
</body>
<script src="preLoadedCapture.js"></script>
<script src="bundle.js"></script>
</html>
@@ -1,21 +0,0 @@
{
"name": "jsc-heap-capture",
"version": "1.0.0",
"description": "processes captured heaps from javascript core",
"main": "bundle.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"author": "cwdick",
"devDependencies": {
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-plugin-transform-class-properties": "^6.16.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"react": "^0.14.1",
"react-dom": "^0.14.1",
"webpack": "^1.13.2"
}
}
@@ -1,190 +0,0 @@
// @flow
import invariant from 'invariant';
import AggrowData, {
AggrowDoubleColumn,
AggrowIntColumn,
AggrowStackColumn,
AggrowStringColumn } from './AggrowData';
import AggrowExpander from './AggrowExpander';
import type { FlattenedStack } from './StackRegistry';
import StackRegistry from './StackRegistry';
export type FocusConfig = {
pattern: RegExp,
firstMatch: boolean,
leftSide: boolean,
}
type FocusPredicate = (frameId: number) => boolean;
export default class Aggrow {
data: AggrowData;
expander: AggrowExpander;
constructor(aggrowData: AggrowData) {
aggrowData.flattenStacks();
this.data = aggrowData;
this.expander = new AggrowExpander(aggrowData.rowCount);
}
addSumAggregator(aggregatorName: string, columnName: string): number {
const column = this.data.getColumn(columnName);
invariant(column, `Column ${columnName} does not exist.`);
invariant(column instanceof AggrowIntColumn || column instanceof AggrowDoubleColumn,
`Sum aggregator does not support ${column.constructor.name} columns!`);
return this.expander.addAggregator(
aggregatorName,
(indices: Int32Array): number => {
let size = 0;
indices.forEach((i: number) => { size += column.get(i); });
return size;
},
(value: any): string => value.toLocaleString(),
(a: number, b: number): number => b - a,
);
}
addCountAggregator(aggregatorName: string): number {
return this.expander.addAggregator(
aggregatorName,
(indices: Int32Array): number => indices.length,
(value: any): string => value.toLocaleString(),
(a: number, b: number): number => b - a,
);
}
addStringExpander(expanderName: string, columnName: string): number {
const column = this.data.getColumn(columnName);
invariant(column, `Column ${columnName} does not exist.`);
invariant(column instanceof AggrowStringColumn, 'String expander needs a string column.');
const strings = column.strings;
return this.expander.addFieldExpander(
expanderName,
(rowA: number, rowB: number): number => column.get(rowA) - column.get(rowB),
(row: number): string => strings.get(column.get(row)),
(s: string): string => s,
);
}
addNumberExpander(expanderName: string, columnName: string): number {
const column = this.data.getColumn(columnName);
invariant(column, `Column ${columnName} does not exist.`);
invariant(
column instanceof AggrowIntColumn || column instanceof AggrowDoubleColumn,
`Number expander does not support ${column.constructor.name} columns.`);
return this.expander.addFieldExpander(
expanderName,
(rowA: number, rowB: number): number => column.get(rowA) - column.get(rowB),
(row: number): number => column.get(row),
(n: any): string => n.toLocaleString(),
);
}
addPointerExpander(expanderName: string, columnName: string): number {
const column = this.data.getColumn(columnName);
invariant(column, `Column ${columnName} does not exist.`);
invariant(
column instanceof AggrowIntColumn,
`Pointer expander does not support ${column.constructor.name} columns.`);
return this.expander.addFieldExpander(
expanderName,
(rowA: number, rowB: number): number => column.get(rowA) - column.get(rowB),
(row: number): number => column.get(row),
(p: number): string => `0x${(p >>> 0).toString(16)}`, // eslint-disable-line no-bitwise
);
}
addStackExpander(
expanderName: string,
columnName: string,
reverse: boolean,
focus: ?FocusConfig): number {
const column = this.data.getColumn(columnName);
invariant(column, `Column ${columnName} does not exist.`);
invariant(
column instanceof AggrowStackColumn,
`Stack expander does not support ${column.constructor.name} columns.`);
let stacks = column.stacks;
const getter = column.getter;
const formatter = column.formatter;
if (focus) {
const re = focus.pattern;
const predicate = (frameId: number): boolean => re.test(formatter(getter(frameId)));
stacks = focusStacks(stacks, predicate, focus.firstMatch, focus.leftSide);
}
return this.expander.addStackExpander(
expanderName,
stacks.maxDepth,
(row: number): FlattenedStack => stacks.get(column.get(row)),
getter,
formatter,
!!reverse,
);
}
}
function focusStacks(
stacks: StackRegistry,
predicate: FocusPredicate,
firstMatch: boolean,
leftSide: boolean): FocusedStackRegistry {
let stackMapper;
if (firstMatch && leftSide) {
stackMapper = (stack: FlattenedStack): FlattenedStack => {
for (let i = 0; i < stack.length; i++) {
if (predicate(stack[i])) {
return stack.subarray(0, i + 1);
}
}
return stack.subarray(0, 0);
};
} else if (firstMatch && !leftSide) {
stackMapper = (stack: FlattenedStack): FlattenedStack => {
for (let i = 0; i < stack.length; i++) {
if (predicate(stack[i])) {
return stack.subarray(i, stack.length);
}
}
return stack.subarray(0, 0);
};
} else if (!firstMatch && leftSide) {
stackMapper = (stack: FlattenedStack): FlattenedStack => {
for (let i = stack.length - 1; i >= 0; i--) {
if (predicate(stack[i])) {
return stack.subarray(0, i + 1);
}
}
return stack.subarray(0, 0);
};
} else { // !firstMatch && !leftSide
stackMapper = (stack: FlattenedStack): FlattenedStack => {
for (let i = stack.length - 1; i >= 0; i--) {
if (predicate(stack[i])) {
return stack.subarray(i, stack.length);
}
}
return stack.subarray(0, 0);
};
}
invariant(stacks.stackIdMap, 'Stacks were not flattened.');
return new FocusedStackRegistry(
stacks.stackIdMap.map(stackMapper),
stacks.maxDepth);
}
class FocusedStackRegistry {
maxDepth: number;
stackIdMap: Array<FlattenedStack>;
constructor(stackIdMap: Array<FlattenedStack>, maxDepth: number) {
this.maxDepth = maxDepth;
this.stackIdMap = stackIdMap;
}
get(id: number): FlattenedStack {
return this.stackIdMap[id];
}
}
Oops, something went wrong.

0 comments on commit af590b0

Please sign in to comment.