Skip to content

Commit ad43b2b

Browse files
author
Jaroslav Tulach
committed
Renaming Histogram to Hotness Top 10
1 parent 598bc10 commit ad43b2b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tools/docs/Insight-Manual.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ As such, whenever the *node.js* framework loaded a script,
4545
the listener got notified of it and could take an action - in this case
4646
printing the length and name of processed script.
4747

48-
### Histogram - Use Full Power of Your Language!
48+
### Hotness Top 10 - Use Full Power of Your Language!
4949

5050
Collecting the insights information isn't limited to simple print statement.
5151
One can perform any Turing complete computation in your language. Imagine
52-
following `function-histogram-tracing.js` that counts all method invocations
52+
following `function-hotness-tracing.js` that counts all method invocations
5353
and dumps the most frequent ones when the execution of your program is over:
5454

5555
```js
5656
var map = new Map();
5757

58-
function dumpHistogram() {
59-
print("==== Histogram ====");
58+
function dumpHotness() {
59+
print("==== Hotness Top 10 ====");
6060
var digits = 3;
6161
Array.from(map.entries()).sort((one, two) => two[1] - one[1]).forEach(function (entry) {
6262
var number = entry[1].toString();
@@ -67,7 +67,7 @@ function dumpHistogram() {
6767
}
6868
if (number > 10) print(`${number} calls to ${entry[0]}`);
6969
});
70-
print("===================");
70+
print("========================");
7171
}
7272

7373
insight.on('enter', function(ev) {
@@ -82,18 +82,18 @@ insight.on('enter', function(ev) {
8282
roots: true
8383
});
8484

85-
insight.on('close', dumpHistogram);
85+
insight.on('close', dumpHotness);
8686
```
8787

8888
The `map` is a global variable visible for the whole **Insight** script that
89-
allows the code to share data between the `insight.on('enter')` function and the `dumpHistogram`
89+
allows the code to share data between the `insight.on('enter')` function and the `dumpHotness`
9090
function. The latter is executed when the `node` process execution is over (registered via
91-
`insight.on('close', dumpHistogram)`. Invoke as:
91+
`insight.on('close', dumpHotness)`. Invoke as:
9292

9393
```bash
94-
$ graalvm/bin/node --experimental-options --js.print --insight=function-histogram-tracing.js -e "print('The result: ' + 6 * 7)"
94+
$ graalvm/bin/node --experimental-options --js.print --insight=function-hotness-tracing.js -e "print('The result: ' + 6 * 7)"
9595
The result: 42
96-
=== Histogram ===
96+
==== Hotness Top 10 ====
9797
543 calls to isPosixPathSeparator
9898
211 calls to E
9999
211 calls to makeNodeErrorWithCode
@@ -111,7 +111,7 @@ The result: 42
111111
13 calls to copyPrototype
112112
13 calls to hideStackFrames
113113
13 calls to addReadOnlyProcessAlias
114-
=================
114+
========================
115115
```
116116

117117
Table with names and counts of function invocations is printed out when the

0 commit comments

Comments
 (0)