Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | #ifndef AOS_REALTIME_H_ |
| 2 | #define AOS_REALTIME_H_ |
| 3 | |
James Kuszmaul | 57c2baa | 2020-01-19 14:52:52 -0800 | [diff] [blame] | 4 | #include <string_view> |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 5 | |
| 6 | namespace aos { |
| 7 | |
| 8 | // Locks everything into memory and sets the limits. This plus InitNRT are |
| 9 | // everything you need to do before SetCurrentThreadRealtimePriority will make |
| 10 | // your thread RT. Called as part of ShmEventLoop::Run() |
| 11 | void InitRT(); |
| 12 | |
| 13 | // Sets the current thread back down to non-realtime priority. |
| 14 | void UnsetCurrentThreadRealtimePriority(); |
| 15 | |
| 16 | // Sets the name of the current thread. |
| 17 | // This will displayed by `top -H`, dump_rtprio, and show up in logs. |
| 18 | // name can have a maximum of 16 characters. |
James Kuszmaul | 57c2baa | 2020-01-19 14:52:52 -0800 | [diff] [blame] | 19 | void SetCurrentThreadName(const std::string_view name); |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 20 | |
| 21 | // Sets the current thread's realtime priority. |
| 22 | void SetCurrentThreadRealtimePriority(int priority); |
| 23 | |
| 24 | // Sets up this process to write core dump files. |
| 25 | // This is called by Init*, but it's here for other files that want this |
| 26 | // behavior without calling Init*. |
| 27 | void WriteCoreDumps(); |
| 28 | |
| 29 | void LockAllMemory(); |
| 30 | |
James Kuszmaul | b4874eb | 2020-01-18 17:50:35 -0800 | [diff] [blame] | 31 | void ExpandStackSize(); |
| 32 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 33 | } // namespace aos |
| 34 | |
| 35 | #endif // AOS_REALTIME_H_ |