diff --git a/miosix/kernel/cpu_time_counter.h b/miosix/kernel/cpu_time_counter.h index 6e05ea083b752f2626e302792d8724c1e5f350b1..b28ea5a7681b72b75718c1f75cdf0a17dd578340 100644 --- a/miosix/kernel/cpu_time_counter.h +++ b/miosix/kernel/cpu_time_counter.h @@ -25,8 +25,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/> * ***************************************************************************/ -#ifndef CPU_TIME_COUNTER_H -#define CPU_TIME_COUNTER_H +#pragma once #include "kernel.h" #include "cpu_time_counter_types.h" @@ -167,12 +166,11 @@ private: * Add the idle thread to the list of threads tracked by CPUTimeCounter. * \param thread The idle thread. */ - static inline void PKaddIdleThread(Thread *thread) + static inline void IRQaddIdleThread(Thread *thread) { thread->timeCounterData.next = head; head = thread; - if (!tail) - tail = thread; + if(!tail) tail = thread; nThreads++; } @@ -185,8 +183,7 @@ private: { tail->timeCounterData.next = thread; tail = thread; - if (!head) - head = thread; + if(!head) head = thread; nThreads++; } @@ -202,14 +199,14 @@ private: * Notify that a context switch is about to happen. * \returns The current time. */ - static inline long long PKwillSwitchContext(); + static inline long long IRQwillSwitchContext(); /** * \internal * Notify that a context switch has just happened. * \param t The time of the context switch. */ - static inline void PKdidSwitchContext(long long t); + static inline void IRQdidSwitchContext(long long t); static Thread *head; ///< Head of the thread list static Thread *tail; ///< Tail of the thread list @@ -223,5 +220,3 @@ private: } #endif // WITH_CPU_TIME_COUNTER - -#endif diff --git a/miosix/kernel/cpu_time_counter_private.h b/miosix/kernel/cpu_time_counter_private.h index 364d7c81044356a63a392305ef508ebc429e4c75..62d24a7256a0e70ed6755fb8a9c29303b9e3b7e4 100644 --- a/miosix/kernel/cpu_time_counter_private.h +++ b/miosix/kernel/cpu_time_counter_private.h @@ -36,14 +36,14 @@ namespace miosix { // Declared in kernel.cpp extern volatile Thread *runningThread; -long long CPUTimeCounter::PKwillSwitchContext() +long long CPUTimeCounter::IRQwillSwitchContext() { long long t=IRQgetTime(); runningThread->timeCounterData.usedCpuTime+=t-runningThread->timeCounterData.lastActivation; return t; } -void CPUTimeCounter::PKdidSwitchContext(long long t) +void CPUTimeCounter::IRQdidSwitchContext(long long t) { runningThread->timeCounterData.lastActivation=t; } diff --git a/miosix/kernel/cpu_time_counter_types.h b/miosix/kernel/cpu_time_counter_types.h index e897667b405201b850fffe339e6d316e6b7198d9..89bfe1d89b5ee19604c48f30705fffadb62520f2 100644 --- a/miosix/kernel/cpu_time_counter_types.h +++ b/miosix/kernel/cpu_time_counter_types.h @@ -25,8 +25,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/> * ***************************************************************************/ -#ifndef CPU_TIME_COUNTER_TYPES_H -#define CPU_TIME_COUNTER_TYPES_H +#pragma once #include "config/miosix_settings.h" @@ -53,5 +52,3 @@ struct CPUTimeCounterPrivateThreadData } #endif // WITH_CPU_TIME_COUNTER - -#endif diff --git a/miosix/kernel/scheduler/scheduler.h b/miosix/kernel/scheduler/scheduler.h index 0398f161f228d977b4da69e78f7394d86611b318..85888f4f48af0f9c198646479019d68e9d69577f 100755 --- a/miosix/kernel/scheduler/scheduler.h +++ b/miosix/kernel/scheduler/scheduler.h @@ -135,7 +135,7 @@ public: static void IRQsetIdleThread(Thread *idleThread) { #ifdef WITH_CPU_TIME_COUNTER - CPUTimeCounter::PKaddIdleThread(idleThread); + CPUTimeCounter::IRQaddIdleThread(idleThread); #endif return T::IRQsetIdleThread(idleThread); } @@ -166,11 +166,11 @@ public: static void IRQfindNextThread() { #ifdef WITH_CPU_TIME_COUNTER - long long t=CPUTimeCounter::PKwillSwitchContext(); + long long t=CPUTimeCounter::IRQwillSwitchContext(); #endif T::IRQfindNextThread(); #ifdef WITH_CPU_TIME_COUNTER - CPUTimeCounter::PKdidSwitchContext(t); + CPUTimeCounter::IRQdidSwitchContext(t); #endif }