Browse Source

Remove process.memoryUsage().vsize

Not meaningful cross platform; unused.
v0.7.4-release
Ryan Dahl 13 years ago
parent
commit
5783a52a9c
  1. 1
      doc/api/process.markdown
  2. 7
      src/node.cc
  3. 2
      src/platform.h
  4. 3
      src/platform_cygwin.cc
  5. 3
      src/platform_darwin.cc
  6. 3
      src/platform_freebsd.cc
  7. 3
      src/platform_linux.cc
  8. 3
      src/platform_none.cc
  9. 3
      src/platform_openbsd.cc
  10. 3
      src/platform_sunos.cc
  11. 3
      src/platform_win32.cc
  12. 1
      test/simple/test-memory-usage.js

1
doc/api/process.markdown

@ -312,7 +312,6 @@ measured in bytes.
This will generate:
{ rss: 4935680,
vsize: 41893888,
heapTotal: 1826816,
heapUsed: 650472 }

7
src/node.cc

@ -106,7 +106,6 @@ static Persistent<String> errpath_symbol;
static Persistent<String> code_symbol;
static Persistent<String> rss_symbol;
static Persistent<String> vsize_symbol;
static Persistent<String> heap_total_symbol;
static Persistent<String> heap_used_symbol;
@ -1582,9 +1581,9 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
HandleScope scope;
assert(args.Length() == 0);
size_t rss, vsize;
size_t rss;
int r = Platform::GetMemory(&rss, &vsize);
int r = Platform::GetMemory(&rss);
if (r != 0) {
return ThrowException(Exception::Error(String::New(strerror(errno))));
@ -1594,13 +1593,11 @@ v8::Handle<v8::Value> MemoryUsage(const v8::Arguments& args) {
if (rss_symbol.IsEmpty()) {
rss_symbol = NODE_PSYMBOL("rss");
vsize_symbol = NODE_PSYMBOL("vsize");
heap_total_symbol = NODE_PSYMBOL("heapTotal");
heap_used_symbol = NODE_PSYMBOL("heapUsed");
}
info->Set(rss_symbol, Integer::NewFromUnsigned(rss));
info->Set(vsize_symbol, Integer::NewFromUnsigned(vsize));
// V8 memory usage
HeapStatistics v8_heap_stats;

2
src/platform.h

@ -32,7 +32,7 @@ class Platform {
static void SetProcessTitle(char *title);
static const char* GetProcessTitle(int *len);
static int GetMemory(size_t *rss, size_t *vsize);
static int GetMemory(size_t *rss);
static int GetCPUInfo(v8::Local<v8::Array> *cpus);
static double GetUptime(bool adjusted = false)
{

3
src/platform_cygwin.cc

@ -167,7 +167,7 @@ const char* Platform::GetProcessTitle(int *len) {
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
FILE *f = fopen("/proc/self/stat", "r");
if (!f) return -1;
@ -222,7 +222,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
/* Virtual memory size */
if (fscanf (f, "%u ", &itmp) == 0) goto error; /* coverity[secure_coding] */
*vsize = (size_t) itmp;
/* Resident set size */
if (fscanf (f, "%u ", &itmp) == 0) goto error; /* coverity[secure_coding] */

3
src/platform_darwin.cc

@ -71,7 +71,7 @@ const char* Platform::GetProcessTitle(int *len) {
// Researched by Tim Becker and Michael Knight
// http://blog.kuriositaet.de/?p=257
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
@ -83,7 +83,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
if (r != KERN_SUCCESS) return -1;
*rss = t_info.resident_size;
*vsize = t_info.virtual_size;
return 0;
}

3
src/platform_freebsd.cc

@ -66,7 +66,7 @@ const char* Platform::GetProcessTitle(int *len) {
return NULL;
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
kvm_t *kd = NULL;
struct kinfo_proc *kinfo = NULL;
pid_t pid;
@ -82,7 +82,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
if (kinfo == NULL) goto error;
*rss = kinfo->ki_rssize * page_size;
*vsize = kinfo->ki_size;
kvm_close(kd);

3
src/platform_linux.cc

@ -125,7 +125,7 @@ const char* Platform::GetProcessTitle(int *len) {
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
FILE *f = fopen("/proc/self/stat", "r");
if (!f) return -1;
@ -195,7 +195,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
/* Virtual memory size */
if (fscanf (f, "%u ", &itmp) == 0) goto error; /* coverity[secure_coding] */
*vsize = (size_t) itmp;
/* Resident set size */
if (fscanf (f, "%u ", &itmp) == 0) goto error; /* coverity[secure_coding] */

3
src/platform_none.cc

@ -42,10 +42,9 @@ const char* OS::GetProcessTitle(int *len) {
}
int OS::GetMemory(size_t *rss, size_t *vsize) {
int OS::GetMemory(size_t *rss) {
// Not implemented
*rss = 0;
*vsize = 0;
return 0;
}

3
src/platform_openbsd.cc

@ -66,7 +66,7 @@ const char* Platform::GetProcessTitle(int *len) {
return NULL;
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
kvm_t *kd = NULL;
struct kinfo_proc2 *kinfo = NULL;
pid_t pid;
@ -82,7 +82,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
if (kinfo == NULL) goto error;
*rss = kinfo->p_vm_rssize * page_size;
*vsize = kinfo->p_uru_ixrss;
kvm_close(kd);

3
src/platform_sunos.cc

@ -79,7 +79,7 @@ const char* Platform::GetProcessTitle(int *len) {
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
pid_t pid = getpid();
size_t page_size = getpagesize();
@ -97,7 +97,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
/* XXX correct? */
*vsize = (size_t) psinfo.pr_size * page_size;
*rss = (size_t) psinfo.pr_rssize * 1024;
fclose (f);

3
src/platform_win32.cc

@ -198,7 +198,7 @@ const char* Platform::GetProcessTitle(int *len) {
}
int Platform::GetMemory(size_t *rss, size_t *vsize) {
int Platform::GetMemory(size_t *rss) {
HANDLE current_process = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS pmc;
@ -209,7 +209,6 @@ int Platform::GetMemory(size_t *rss, size_t *vsize) {
}
*rss = pmc.WorkingSetSize;
*vsize = 0; // FIXME
return 0;
}

1
test/simple/test-memory-usage.js

@ -28,4 +28,3 @@ var assert = require('assert');
var r = process.memoryUsage();
console.log(common.inspect(r));
assert.equal(true, r['rss'] > 0);
assert.equal(true, r['vsize'] > 0);

Loading…
Cancel
Save