Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Jul 3, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 126
Dev docs
Serge edited this page Jul 11, 2015
·
7 revisions
https://github.com/runtimejs/runtime-cli
npm install runtime-cli -gBuild OK: 4.8.0, 4.8.1, 4.8.3, 4.9.1, 5.1
Build FAIL: 4.9.0 (gcc bug when compiling libc++)
GDB install:
export PREFIX="$HOME/opt/cross"export PATH="$PREFIX/bin:$PATH"
wget https://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.gz
tar -xf gdb-7.8.tar.gz
rm gdb-7.8.tar.gz
mkdir build-gdb
cd build-gdb
../gdb-7.8/configure --target=x86_64-pc-linux-gnu --prefix="$PREFIX"
make
make installConnect to running QEMU:
x86_64-pc-linux-gnu-gdb (gdb) target remote localhost:1234 (gdb) symbol-file runtimejsvaru8array=kernel.takeHeapSnapshot();// returns array of snapshot Uint8Array chunksExample to send snapshot over TCP for inspection:
console.log('taking snapshot...');varbufs=kernel.takeHeapSnapshot();console.log('connecting...');varsocket=newruntime.net.TCPSocket();socket.onopen=function(){console.log('pushing snapshot into socket...');for(letbufofbufs){socket.send(buf);}socket.close();console.log('done');};socket.open('192.168.1.2',5555);It might take a while for TCP to transmit full snapshot depending on heap size.
Snapshot receiver:
nc -l 5555 > 1.heapsnapshotSnapshot could be loaded into Chrome's profiles tab for inspection.
kernel.memoryInfo();Returns kernel memory usage. Object with properties (all values in bytes):
heapUsed - js heap used
heapTotal - js heap size
pmUsed - physical memory used
pmTotal - physical memory total (available for allocation)
buffersCount - number of allocated ArrayBuffers
buffersSize - total size of ArrayBuffers