From 453cd2089bc0a435b53c13a6816de8fa41f1c8c1 Mon Sep 17 00:00:00 2001
From: Terraneo Federico <fede.tft@miosix.org>
Date: Sun, 30 Jul 2023 22:59:24 +0200
Subject: [PATCH] Use correct prefixes in profiler

---
 miosix/kernel/cpu_time_counter.h         | 17 ++++++-----------
 miosix/kernel/cpu_time_counter_private.h |  4 ++--
 miosix/kernel/cpu_time_counter_types.h   |  5 +----
 miosix/kernel/scheduler/scheduler.h      |  6 +++---
 4 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/miosix/kernel/cpu_time_counter.h b/miosix/kernel/cpu_time_counter.h
index 6e05ea08..b28ea5a7 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 364d7c81..62d24a72 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 e897667b..89bfe1d8 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 0398f161..85888f4f 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
     }
     
-- 
GitLab