aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/attribute_usage_stats.cpp
blob: 9e28fe95e0199920f775150abea2e1af464eadfb (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
25
26
27
28
29
30
31
32
33
34
35
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "attribute_usage_stats.h"
#include <vespa/searchlib/attribute/address_space_components.h>
#include <iostream>

using search::AddressSpaceComponents;

namespace proton {

AttributeUsageStats::AttributeUsageStats()
    : _max_usage(vespalib::AddressSpace())
{
}

AttributeUsageStats::~AttributeUsageStats() = default;

void
AttributeUsageStats::merge(const search::AddressSpaceUsage &usage,
                           const vespalib::string &attributeName,
                           const vespalib::string &subDbName)
{
    for (const auto& entry : usage.get_all()) {
        _max_usage.merge(entry.second, attributeName, entry.first, subDbName);
    }
}

std::ostream&
operator<<(std::ostream& out, const AttributeUsageStats& rhs)
{
    out << "{max_address_space_usage=" << rhs.max_address_space_usage() << "}";
    return out;
}

} // namespace proton