Belle II Software light-2406-ragdoll
utils.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <framework/utilities/Utils.h>
9
10#include <TSystem.h>
11
12#include <gtest/gtest.h>
13
14using namespace std;
15using namespace Belle2;
16
17namespace {
18 TEST(Utilities, MemSize)
19 {
20 //compare memory measurements done by root and ourselves
21 //(should differ by less than 1MB even though function calls are a bit different)
22 ProcInfo_t meminfo;
23 gSystem->GetProcInfo(&meminfo);
25 ASSERT_TRUE(abs(v - meminfo.fMemVirtual) < 1000);
26
27 gSystem->GetProcInfo(&meminfo);
28 long r = Utils::getRssMemoryKB();
29 ASSERT_TRUE(abs(r - meminfo.fMemResident) < 1000);
30 }
31}
unsigned long getRssMemoryKB()
Returns the amount of memory the process actually occupies in the physical RAM of the machine.
Definition: Utils.cc:84
unsigned long getVirtualMemoryKB()
Returns currently used virtual memory in KB, includes swapped and not occupied memory pages and memor...
Definition: Utils.cc:79
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
STL namespace.