IceFlow NDN-based stream processing library written in C++
Loading...
Searching...
No Matches
measurements.hpp
1/*
2 * Copyright 2022 The IceFlow Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 */
18
19#ifndef ICEFLOW_CORE_MEASUREMENTS_H
20#define ICEFLOW_CORE_MEASUREMENTS_H
21
22#include <chrono>
23#include <filesystem>
24#include <fstream>
25#include <iostream>
26#include <sstream>
27
28namespace iceflow {
29
30struct Entry {
31 std::string interest;
32 std::string entryname;
33 uint64_t timestamp;
34 uint64_t size;
35};
36
38public:
39 Measurement(const std::string &measurementId, const std::string &nodeName,
40 uint64_t saveThreshold, const std::string &observedObject);
42
43 void createMeasurementFolder();
44
45 void setField(const std::string &interestName, const std::string &entryName,
46 uint64_t dataSize);
47
48 void recordToFile();
49
50private:
51 std::string m_fileName;
52 std::string m_nodeName;
53 std::string m_measurementId;
54 std::string m_observedObject;
55 int m_fileCount;
56 std::vector<Entry> m_entries;
57 uint64_t m_saveThreshold;
58 std::ofstream m_ofstream;
59};
60
61} // namespace iceflow
62
63#endif // ICEFLOW_CORE_MEASUREMENTS_H
Definition measurements.hpp:37
Definition measurements.hpp:30