Motorcortex Core  version: 2.7.6
utl_realtime.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2015 VECTIONEER.
4  */
5 
6 #ifndef UTILS_UTL_REALTIME_H
7 #define UTILS_UTL_REALTIME_H
8 
9 #include "cmdline_realtime.h"
10 #include <cstddef>
11 #include <pthread.h>
12 #include <stdint.h>
13 #include <sys/resource.h>
14 #include <vector>
15 
16 namespace mcx {
17 
18 namespace utils {
19 
26 bool setStackSize(pthread_attr_t& attr, size_t size_bytes);
27 
33 size_t getStackSize(pthread_attr_t& attr);
34 
41 bool prefaultThreadStack(pthread_attr_t& attr);
42 
49 struct PageFaults {
50  long major;
51  long minor;
52 };
53 
62 PageFaults getPageFaults(PageFaults* page_faults, int where = RUSAGE_THREAD);
63 
64 bool showPageFaults(PageFaults* page_faults, int where = RUSAGE_THREAD);
65 
70 bool running();
71 
78 bool startRealTime(const std::vector<uint32_t>& cpu_list, size_t size_mb = 256);
79 
85 bool startRealTime(cmd_line::Realtime opt);
86 
91 bool startRealTime();
92 
98 
101 void stopRealTime();
102 
105 } // namespace utils
106 
107 } // namespace mcx
108 
109 #endif // UTILS_UTL_REALTIME_H
mcx::cmd_line::Realtime
Definition: cmdline_realtime.h:14
mcx::utils::PageFaults::major
long major
A major page fault.
Definition: utl_realtime.h:50
mcx::utils::running
bool running()
Definition: utl_realtime.cpp:194
mcx::utils::PageFaults
Page faults.
Definition: utl_realtime.h:49
mcx::utils::PageFaults::minor
long minor
A minor page fault.
Definition: utl_realtime.h:51
mcx::utils::stopRealTime
void stopRealTime(cmd_line::Realtime opt)
Deactivate Real-time mode, removes CPUs' isolation.
Definition: utl_realtime.cpp:283