aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/memoryusage.cpp
blob: fa0f452935869d6919fbfa028de535f3957b70d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "memoryusage.h"
#include <vespa/vespalib/stllike/asciistream.h>

namespace vespalib {

string
MemoryUsage::toString() const {
    vespalib::asciistream os;
    os << *this;
    return os.str();
}

asciistream &
operator << (asciistream & os, const MemoryUsage & usage) {
    os << "allocated: " << usage.allocatedBytes();
    os << ", used: " << usage.usedBytes();
    os << ", dead: " << usage.deadBytes();
    os << ", onhold: " << usage.allocatedBytesOnHold();
    return os;
}

} // namespace vespalib