Apollo
10.0
自动驾驶开放平台
recurrent_runner.cc
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2017 The Apollo Authors. All Rights Reserved.
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
17
#include "
modules/monitor/common/recurrent_runner.h
"
18
19
#include "
cyber/common/log.h
"
20
21
namespace
apollo
{
22
namespace
monitor {
23
24
RecurrentRunner::RecurrentRunner
(
const
std::string &name,
const
double
interval)
25
: name_(name), interval_(interval) {}
26
27
void
RecurrentRunner::Tick
(
const
double
current_time) {
28
if
(
name_
==
"ProcessMonitor"
&&
29
MonitorManager::Instance()->GetStatus()->detect_immediately()) {
30
RunOnce
(current_time);
31
}
else
if
(next_round_ <= current_time) {
32
++
round_count_
;
33
AINFO_EVERY
(100) <<
name_
<<
" is running round #"
<<
round_count_
;
34
next_round_ = current_time + interval_;
35
RunOnce
(current_time);
36
}
37
}
38
39
}
// namespace monitor
40
}
// namespace apollo
apollo::monitor::RecurrentRunner::Tick
void Tick(const double current_time)
Definition
recurrent_runner.cc:27
apollo::monitor::RecurrentRunner::RecurrentRunner
RecurrentRunner(const std::string &name, const double interval)
Definition
recurrent_runner.cc:24
apollo::monitor::RecurrentRunner::RunOnce
virtual void RunOnce(const double current_time)=0
apollo::monitor::RecurrentRunner::name_
std::string name_
Definition
recurrent_runner.h:43
apollo::monitor::RecurrentRunner::round_count_
unsigned int round_count_
Definition
recurrent_runner.h:44
log.h
AINFO_EVERY
#define AINFO_EVERY(freq)
Definition
log.h:82
apollo
class register implement
Definition
arena_queue.h:37
recurrent_runner.h
modules
monitor
common
recurrent_runner.cc