Example #1
0
double MemWatch::inUse() {
 #if USE_BOOST_THREAD
        boost::mutex::scoped_lock lock(__readproc__mutex__);
 #endif

 #ifdef WIN32_LEAN_AND_MEAN

    PROCESS_MEMORY_COUNTERS pmc;

    if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))){
        double ret = mByte(pmc.WorkingSetSize);
        return ret;
    } else { return 0; }

#else
    #if USE_PROC_READPROC
    struct proc_t usage;
    look_up_our_self(& usage);
    double ret = mByte(usage.vsize);
    return ret;
    #else // no windows and no libproc

    #endif // no libproc
#endif // no windows
    return 0;
}
Example #2
0
void print_mem(const std::string &s)
{
#ifndef MINDEPS
    struct proc_t usage;
    look_up_our_self(&usage);
    if (s.empty())
    {
        printf("* Peak vsize (physical memory+swap) in mebibytes: %lu\n", usage.vsize >> 20);
    }
Example #3
0
 inline long long
 getRss(void) {
     proc_t proc;
     look_up_our_self(&proc);
     return proc.rss;
 }
Example #4
0
 inline long long
 getVsize(void) {
     proc_t proc;
     look_up_our_self(&proc);
     return proc.vsize;
 }
Example #5
0
void print_resource_usage() {
	struct proc_t u;
	look_up_our_self(&u);
	printf("rss usage: %lu bytes\n", u.rss * __PG_SIZE);
}