@@ -45,18 +45,18 @@ As such, whenever the *node.js* framework loaded a script,
4545the listener got notified of it and could take an action - in this case
4646printing 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
5050Collecting the insights information isn't limited to simple print statement.
5151One 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
5353and dumps the most frequent ones when the execution of your program is over:
5454
5555``` js
5656var 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
7373insight .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
8888The ` 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 `
9090function. 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)"
9595The result: 42
96- === Histogram ===
96+ ==== Hotness Top 10 = ===
9797543 calls to isPosixPathSeparator
9898211 calls to E
9999211 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
117117Table with names and counts of function invocations is printed out when the
@@ -355,7 +355,7 @@ R: observed loading of test.R
355355
356356The only change is the R language. All the other [ Insight] ( Insight.md )
357357features and
358- [ APIs] ( https://www.graalvm.org/tools/javadoc/com/oracle/truffle/ tools/agentscript/AgentScript .html#VERSION )
358+ [ APIs] ( https://www.graalvm.org/tools/javadoc/org/graalvm/ tools/insight/Insight .html#VERSION )
359359remain the same.
360360
361361### Inspecting Values
@@ -448,9 +448,9 @@ instrument. Never the less, the compatibility of the **Insight** API
448448exposed via the ` insight ` object
449449is treated seriously.
450450
451- The [ documentation] ( https://www.graalvm.org/tools/javadoc/com/oracle/truffle/ tools/agentscript/AgentScript .html )
451+ The [ documentation] ( https://www.graalvm.org/tools/javadoc/org/graalvm/ tools/insight/Insight .html )
452452of the ` insight ` object properties and functions is available as part of its
453- [ javadoc] ( https://www.graalvm.org/tools/javadoc/com/oracle/truffle/ tools/agentscript/AgentScript .html#VERSION ) .
453+ [ javadoc] ( https://www.graalvm.org/tools/javadoc/org/graalvm/ tools/insight/Insight .html#VERSION ) .
454454
455455Future versions will add new features, but whatever has
456456once been exposed, remains functional. If your script depends on some fancy new
@@ -461,7 +461,7 @@ print(`GraalVM Insight version is ${insight.version}`);
461461```
462462
463463and act accordingly to the obtained version. New elements in the
464- [ documentation] ( https://www.graalvm.org/tools/javadoc/com/oracle/truffle/ tools/agentscript/AgentScript .html )
464+ [ documentation] ( https://www.graalvm.org/tools/javadoc/org/graalvm/ tools/insight/Insight .html )
465465carry associated ` @since ` tag to describe the minimimal version the associated
466466functionality/element is available since.
467467
0 commit comments