#include "WireCellUtil/MemUsage.h"
#include <iostream>
#include <sstream>
#include <vector>
Go to the source code of this file.
void blow |
( |
MemUsage & |
mu, |
|
|
int |
siz, |
|
|
int * |
buf |
|
) |
| |
Definition at line 33 of file test_memusage.cxx.
38 ss <<
"freed " << siz <<
"K";
39 cout << ss.str() <<
" " << mu(ss.str()) <<
endl;
QTextStream & endl(QTextStream &s)
Definition at line 42 of file test_memusage.cxx.
50 long sizes[] = {10, 100, 1000, 10000, 100000, 1000000, -1};
54 for (; sizes[ind] > 0; ++ind) {
55 int* buf =
suck(mu, sizes[ind]);
59 for (--ind; ind >= 0; --ind) {
60 blow(mu, sizes[ind], bufs[ind]);
63 cout <<
"Summary:" <<
endl;
void blow(MemUsage &mu, int siz, int *buf)
double memusage_resident()
std::string summary() const
Return summary up to now.
int * suck(MemUsage &mu, long siz)
QTextStream & endl(QTextStream &s)
Definition at line 11 of file test_memusage.cxx.
13 int *buf =
new int[siz * 1024];
17 ss <<
"newed " << siz <<
"K";
18 cout << ss.str() <<
" " << mu(ss.str()) <<
endl;
21 for (
int ind=0; ind<siz; ++ind) {
26 ss <<
"accessed " << siz <<
"K";
27 cout << ss.str() <<
" " << mu(ss.str()) <<
endl;
QTextStream & endl(QTextStream &s)