blob: 2507b2cfaaa12eac1122b1ad8e0a83d9e7416d66 (
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
36
37
38
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "visitorstatistics.h"
#include <ostream>
namespace vdslib {
VisitorStatistics::VisitorStatistics()
: _bucketsVisited(0),
_documentsVisited(0),
_bytesVisited(0),
_documentsReturned(0),
_bytesReturned(0)
{
}
VisitorStatistics
VisitorStatistics::operator+(const VisitorStatistics& other) {
VisitorStatistics vs;
vs.setBucketsVisited(_bucketsVisited + other._bucketsVisited);
vs.setDocumentsVisited(_documentsVisited + other._documentsVisited);
vs.setBytesVisited(_bytesVisited + other._bytesVisited);
vs.setDocumentsReturned(_documentsReturned + other._documentsReturned);
vs.setBytesReturned(_bytesReturned + other._bytesReturned);
return vs;
}
void
VisitorStatistics::print(std::ostream& out, bool, const std::string& indent) const
{
out << indent << "Buckets visited: " << _bucketsVisited << "\n";
out << indent << "Documents visited: " << _documentsVisited << "\n";
out << indent << "Bytes visited: " << _bytesVisited << "\n";
out << indent << "Documents returned: " << _documentsReturned << "\n";
out << indent << "Bytes returned: " << _bytesReturned << "\n";
}
}
|