-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Pelanek
committed
Jun 18, 2024
1 parent
f3a5efc
commit e86af62
Showing
6 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @file | ||
* @author Daniel Pelanek <xpeland00@vutbr.cz> | ||
* @brief Shows how the aggregated files are used and it's methods | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#include <telemetry.hpp> | ||
#include <appFs.hpp> | ||
|
||
// example help | ||
#include <iostream> | ||
|
||
telemetry::Content returnValue(int value) { | ||
return telemetry::Scalar(value); | ||
} | ||
|
||
int main() { | ||
// Same as basic example | ||
std::shared_ptr<telemetry::Directory> telemetryRootNode; | ||
telemetryRootNode = telemetry::Directory::create(); | ||
|
||
std::string fusePath = "fusedir"; | ||
|
||
telemetry::appFs::AppFsFuse fuse = telemetry::appFs::AppFsFuse(telemetryRootNode, fusePath, true, true); | ||
fuse.start(); | ||
|
||
const telemetry::FileOps fileOps1 | ||
= {[]() { return returnValue(2); }, nullptr}; | ||
|
||
const telemetry::FileOps fileOps2 | ||
= {[]() { return returnValue(5); }, nullptr}; | ||
|
||
auto aggFileDir = telemetryRootNode->addDir("aggDir"); | ||
auto file1 = aggFileDir->addFile("file1", fileOps1); | ||
auto file2 = aggFileDir->addFile("file2", fileOps2); | ||
|
||
const telemetry::AggOperation aggOp = {telemetry::AggMethodType::JOIN, "", "1"}; | ||
const telemetry::AggOperation aggOp1 = {telemetry::AggMethodType::AVG}; | ||
const telemetry::AggOperation aggOp2 = {telemetry::AggMethodType::SUM}; | ||
|
||
|
||
std::vector<telemetry::AggOperation> aggOps = {aggOp}; | ||
std::vector<telemetry::AggOperation> aggOps1 = {aggOp1}; | ||
std::vector<telemetry::AggOperation> aggOps2 = {aggOp2}; | ||
|
||
auto aggFile = aggFileDir->addAggFile("aggFile", "file[0-9]+", aggOps); | ||
auto aggFile1 = aggFileDir->addAggFile("aggFile1", "file[0-9]+", aggOps1); | ||
auto aggFile2 = aggFileDir->addAggFile("aggFile2", "file[0-9]+", aggOps2); | ||
|
||
|
||
std::cout << telemetry::contentToString(aggFile->read()) << "\n"; | ||
std::cout << telemetry::contentToString(aggFile1->read()) << "\n"; | ||
std::cout << telemetry::contentToString(aggFile2->read()) << "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters