This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2014, Ben Noordhuis <info@bnoordhuis.nl> | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above | |
// copyright notice and this permission notice appear in all copies. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile at -O0 and -O1 or higher and compare the output of | |
// `strace -e pwritev a.out`. At -O0: | |
// | |
// pwritev(1, [{"Hello ", 6}, {"world!", 6}, {"\n", 1}], 3, 0) = -1 ESPIPE | |
// (Illegal seek) | |
// | |
// At -O1 or higher: | |
// | |
// pwritev(1, [{"", 0}, {"H\211l$\330L\211d$\340H\215-\367\10 \0L\215%\350\10 | |
// \0H\211\\$\320L\211l"..., 4195360}, {"", 0}], 3, 0) = -1 ESPIPE (Illegal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "v8.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <cxxabi.h> | |
#include <dlfcn.h> | |
using namespace v8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var net = require('net'); | |
var http = require('http'); | |
var https = require('https'); | |
var httpAddress = '/path/to/http.sock'; | |
var httpsAddress = '/path/to/https.sock'; | |
fs.unlinkSync(httpAddress); | |
fs.unlinkSync(httpsAddress); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/node.cc b/src/node.cc | |
index 32cff12..3c5b616 100644 | |
--- a/src/node.cc | |
+++ b/src/node.cc | |
@@ -2954,6 +2954,36 @@ static char **copy_argv(int argc, char **argv) { | |
return argv_copy; | |
} | |
+ | |
+static void OnJitCodeEvent(const JitCodeEvent* event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/syscall.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#ifndef SYS___pthread_chdir | |
# define SYS___pthread_chdir 348 | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "v8.h" | |
#include <assert.h> | |
#include <unistd.h> | |
using namespace v8; | |
struct WrappedContext | |
{ | |
WrappedContext(Handle<Object> obj) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stap | |
global samples | |
global all_samples | |
global timestamp | |
probe process("node").mark("gc__start") | |
{ | |
timestamp = gettimeofday_us() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var a = [], i = 0; i < 64*1024*1024; ++i) a.push(123.456); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcc -DUSE_MMAP=0 tmp/rss.c && ./a.out | |
rss 360448 | |
============== | |
rss 360448 | |
rss 1429504 | |
rss 552960 | |
============== | |
rss 552960 | |
rss 1359872 | |
rss 1359872 |