Program Listing for File rt_tools.hpp
Program Listing for File rt_tools.hpp#
↰ Return to documentation for file (corail/include/utils/rt_tools.hpp
)
/*
* Corail version 1.0, by Benoit Varillon and David Doose and Jean-Baptiste Chaudron and Charles Lesir-Cabaniols
* Copyright 2021 ISAE-Supaero, Université de Toulouse, France
*
* This file is part of the Corail project.
*
* Corail is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Corail is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Corail. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef UTILS__RT_TOOLS__HPP
#define UTILS__RT_TOOLS__HPP
#include <string>
#include <vector>
#include <chrono>
#include "pthread.h"
namespace utils
{
constexpr auto CLOCK = CLOCK_MONOTONIC;
std::string policy_to_str(const int &policy);
void add_ns(timespec &clock, uint64_t ns);
void set_ns(timespec &clock, uint64_t ns);
uint64_t now_ns();
void timespec_add(timespec &t1, const timespec &t2);
int64_t timespec_to_nsec(const timespec &time);
bool set_cpu(int cpu);
bool set_priority(int priority);
}
#endif
Corail is free software: you can redistribute it and/or modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.