You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply this script to [agent-fib.js](https://github.com/oracle/graal/blob/5ec71a206aa422078ac21be9949f8eb8918b3d3c/vm/tests/all/agentscript/agent-fib.js){:target="_blank"} using the following command:
The above Ruby script example prints out value of variable `n` when a function `minusOne` in the [agent-fib.js](https://github.com/oracle/graal/blob/5ec71a206aa422078ac21be9949f8eb8918b3d3c/vm/tests/all/agentscript/agent-fib.js){:target="_blank"} program is called:
The GraalVM `clang` wrapper adds special options instructing the regular `clang` to keep the LLVM bitcode information in the `sieve` executable along the normal native code.
369
365
The GraalVM's `lli` interpreter can then use the bitcode to interpret the program at full speed.
370
-
By the way, compare the result of direct native execution via `./sieve` and interpreter speed of `graalvm/bin/lli sieve`.
366
+
By the way, compare the result of direct native execution via `./sieve` and interpreter speed of `./bin/lli sieve`.
371
367
It should show quite good results as for an interpreter.
372
368
373
369
Now focus on breaking the endless loop. You can do it with this JavaScript `agent-limit.js` Insight script:
@@ -389,7 +385,7 @@ The script counts the number of invocations of the C `nextNatural` function and
Print out a message everytime a new prime is added into the filter list:
415
411
416
412
```bash
417
-
graalvm/bin/lli --polyglot --insight=agent-limit.js sieve | head -n 3
413
+
./bin/lli --polyglot --insight=agent-limit.js sieve | head -n 3
418
414
found new prime number 2
419
415
found new prime number 3
420
416
found new prime number 5
@@ -451,7 +447,7 @@ print("Two is the result " + fib(3));
451
447
When the instrument is stored in a `fib-trace.js` file and the actual code in `fib.js`, then invoking following command yields detailed information about the program execution and parameters passed between function invocations:
Hundred thousand prime numbers from 2 to 1299709 has sum 62260698721
780
776
Hundred thousand prime numbers in 74 ms
781
777
```
@@ -847,7 +843,7 @@ Save the code snippet as a `dump.js` file.
847
843
Get the [sieve.js](https://github.com/oracle/graal/blob/5ec71a206aa422078ac21be9949f8eb8918b3d3c/vm/benchmarks/agentscript/sieve.js){:target="_blank"} file and launch it as:
Now you can use the [OpenTracing API](https://github.com/opentracing/opentracing-javascript) provided by the `jaeger-client` module in your instrument `agent.js` via the `tracer` object (once it becomes available, it will discussed later in this guide):
Copy file name to clipboardExpand all lines: docs/tools/insight/README.md
+21-25Lines changed: 21 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,12 +27,14 @@ To learn about Insight on versions 20.0 and 19.3, proceed [here](https://github.
27
27
1. Create a simple _source-tracing.js_ script with the following content:
28
28
```javascript
29
29
insight.on('source', function(ev) {
30
-
print(`Loading ${ev.characters.length} characters from ${ev.name}`);
30
+
if (ev.characters) {
31
+
print(`Loading ${ev.characters.length} characters from ${ev.name}`);
32
+
}
31
33
});
32
34
```
33
-
2. Having set `JAVA_HOME` to the GraalVM home directory, start the `node` launcher with the `--insight` tool and observe what scripts are being loaded and evaluated:
35
+
2. Having installed the [Node.js runtime](https://github.com/oracle/graaljs/blob/master/docs/user/NodeJS.md#nodejs-runtime), start the `node` launcher with the `--insight` tool and observe what scripts are being loaded and evaluated:
Ruby: observed loading of internal/per_context/primordials.js
@@ -196,7 +192,7 @@ print("Two is the result " + fib(3));
196
192
197
193
When the instrument is stored in a `fib-trace.js` file and the actual code is in `fib.js`, invoking the following command yields detailed information about the program execution and parameters passed between function invocations:
0 commit comments