$darkmode
cloe
simulation_statistics.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2024 Robert Bosch GmbH
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
*/
22
#pragma once
23
24
#include <
cloe/utility/statistics.hpp
>
// for Accumulator
25
#include <
fable/json.hpp
>
26
27
namespace
engine {
28
29
struct
SimulationStatistics
{
30
cloe::utility::Accumulator
engine_time_ms;
31
cloe::utility::Accumulator
cycle_time_ms;
32
cloe::utility::Accumulator
simulator_time_ms;
33
cloe::utility::Accumulator
controller_time_ms;
34
cloe::utility::Accumulator
padding_time_ms;
35
cloe::utility::Accumulator
controller_retries;
36
37
void
reset() {
38
engine_time_ms.
reset
();
39
cycle_time_ms.
reset
();
40
simulator_time_ms.
reset
();
41
controller_time_ms.
reset
();
42
padding_time_ms.
reset
();
43
controller_retries.
reset
();
44
}
45
46
friend
void
to_json(
fable::Json
& j,
const
SimulationStatistics
& s) {
47
j =
fable::Json
{
48
{
"engine_time_ms"
, s.engine_time_ms}, {
"simulator_time_ms"
, s.simulator_time_ms},
49
{
"controller_time_ms"
, s.controller_time_ms}, {
"padding_time_ms"
, s.padding_time_ms},
50
{
"cycle_time_ms"
, s.cycle_time_ms}, {
"controller_retries"
, s.controller_retries},
51
};
52
}
53
};
54
55
}
// namespace engine
cloe::utility::Accumulator
Definition:
statistics.hpp:110
cloe::utility::Accumulator::reset
void reset()
Definition:
statistics.hpp:119
fable::Json
nlohmann::json Json
Definition:
fable_fwd.hpp:35
json.hpp
statistics.hpp
engine::SimulationStatistics
Definition:
simulation_statistics.hpp:29
engine
src
simulation_statistics.hpp
Generated on Mon Jul 15 2024 14:31:24 for cloe by
1.9.1