Commit 3281dfac authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5368 remove code which is unused except by a test I wrote, and is also very non-portable


git-svn-id: file:///svn/toku/tokudb@48347 c7de825b-a66e-492c-adef-691d508d4ae1
parent eb791c02
......@@ -84,16 +84,6 @@ static void scanrace_shutdown (void) {
r = db->close(db, 0); assert(r==0);
r = tid->commit(tid, 0); assert(r==0);
r = env->close(env, 0); assert(r==0);
#if 0
{
extern int toku_os_get_max_rss(int64_t*);
int64_t mrss;
int r = toku_os_get_max_rss(&mrss);
assert(r==0);
printf("maxrss=%.2fMB\n", mrss/256.0);
}
#endif
}
static double gettime (void) {
......
......@@ -179,9 +179,6 @@ namespace test {
printf("inserts: %.03lf\nqueries: %.03lf\niterate: %.03lf\noverhead: %zu\n",
inserttime, querytime, itertime, overhead);
}
int64_t maxrss;
toku_os_get_max_rss(&maxrss);
printf("memused: %" PRId64 "\n", maxrss);
}
inline int intcmp(const int &a, const int &b);
......
......@@ -190,64 +190,6 @@ toku_os_initialize_settings(int UU(verbosity)) {
return r;
}
int
toku_os_get_max_rss(int64_t *maxrss) {
int r;
char statusname[100];
sprintf(statusname, "/proc/%d/status", getpid());
FILE *f = fopen(statusname, "r");
if (f == NULL) {
struct rusage rusage;
r = getrusage(RUSAGE_SELF, &rusage);
if (r != 0) {
return get_error_errno();
}
*maxrss = rusage.ru_maxrss * 1024; // ru_maxrss is in kB
return 0;
}
r = ENOENT;
char line[100];
while (fgets(line, sizeof line, f)) {
r = sscanf(line, "VmHWM:\t%lld kB\n", (long long *) maxrss);
if (r == 1) {
*maxrss *= 1<<10;
r = 0;
break;
}
}
fclose(f);
return r;
}
int
toku_os_get_rss(int64_t *rss) {
int r;
char statusname[100];
sprintf(statusname, "/proc/%d/status", getpid());
FILE *f = fopen(statusname, "r");
if (f == NULL) {
struct rusage rusage;
r = getrusage(RUSAGE_SELF, &rusage);
if (r != 0) {
return get_error_errno();
}
*rss = (rusage.ru_idrss + rusage.ru_ixrss + rusage.ru_isrss) * 1024;
return 0;
}
r = ENOENT;
char line[100];
while (fgets(line, sizeof line, f)) {
r = sscanf(line, "VmRSS:\t%lld kB\n", (long long *) rss);
if (r == 1) {
*rss *= 1<<10;
r = 0;
break;
}
}
fclose(f);
return r;
}
bool toku_os_is_absolute_name(const char* path) {
return path[0] == '/';
}
......
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <stdio.h>
#include <stdlib.h>
#include <toku_assert.h>
#include <string.h>
#include <toku_stdint.h>
#include <toku_os.h>
const int nbuffers = 1000;
const int buffersize = 1024*1024;
static void do_mallocs(void) {
int i;
void *vp[nbuffers];
for (i=0; i<nbuffers; i++) {
int nbytes = buffersize;
vp[i] = malloc(nbytes);
memset(vp[i], 0, nbytes);
}
for (i=0; i<nbuffers; i++)
free(vp[i]);
}
int main(int argc, char *argv[]) {
int verbose = 0;
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-v") == 0) {
verbose = 1;
continue;
}
if (strcmp(argv[i], "-q") == 0) {
verbose = 0;
continue;
}
}
int64_t rss;
int r = toku_os_get_max_rss(&rss);
invariant_zero(r);
if (verbose) printf("%" PRId64 "\n", rss);
assert(rss < nbuffers*buffersize);
do_mallocs();
r = toku_os_get_max_rss(&rss);
invariant_zero(r);
if (verbose) printf("%" PRId64 "\n", rss);
assert(rss > nbuffers*buffersize);
return 0;
}
......@@ -54,12 +54,6 @@ int toku_os_mkdir(const char *pathname, mode_t mode) __attribute__((__visibility
// Get the current process user and kernel use times
int toku_os_get_process_times(struct timeval *usertime, struct timeval *kerneltime);
// Get the current in memory size (in bytes) of the current process
int toku_os_get_rss(int64_t *rss);
// Get the maximum in memory size (in bytes) of the current process
int toku_os_get_max_rss(int64_t *maxrss);
// Get the maximum size of the process data size (in bytes)
// Success: returns 0 and sets *maxdata to the data size
// Fail: returns an error number
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment