Skip to content
Snippets Groups Projects
Commit 453cd208 authored by Federico's avatar Federico
Browse files

Use correct prefixes in profiler

parent 5caee5ef
Branches
No related tags found
2 merge requests!40Update to Miosix 2.7,!17Draft: Improved miosix build system and fixed cmake scripts
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> * * along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/ ***************************************************************************/
#ifndef CPU_TIME_COUNTER_H #pragma once
#define CPU_TIME_COUNTER_H
#include "kernel.h" #include "kernel.h"
#include "cpu_time_counter_types.h" #include "cpu_time_counter_types.h"
...@@ -167,12 +166,11 @@ private: ...@@ -167,12 +166,11 @@ private:
* Add the idle thread to the list of threads tracked by CPUTimeCounter. * Add the idle thread to the list of threads tracked by CPUTimeCounter.
* \param thread The idle thread. * \param thread The idle thread.
*/ */
static inline void PKaddIdleThread(Thread *thread) static inline void IRQaddIdleThread(Thread *thread)
{ {
thread->timeCounterData.next = head; thread->timeCounterData.next = head;
head = thread; head = thread;
if (!tail) if(!tail) tail = thread;
tail = thread;
nThreads++; nThreads++;
} }
...@@ -185,8 +183,7 @@ private: ...@@ -185,8 +183,7 @@ private:
{ {
tail->timeCounterData.next = thread; tail->timeCounterData.next = thread;
tail = thread; tail = thread;
if (!head) if(!head) head = thread;
head = thread;
nThreads++; nThreads++;
} }
...@@ -202,14 +199,14 @@ private: ...@@ -202,14 +199,14 @@ private:
* Notify that a context switch is about to happen. * Notify that a context switch is about to happen.
* \returns The current time. * \returns The current time.
*/ */
static inline long long PKwillSwitchContext(); static inline long long IRQwillSwitchContext();
/** /**
* \internal * \internal
* Notify that a context switch has just happened. * Notify that a context switch has just happened.
* \param t The time of the context switch. * \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 *head; ///< Head of the thread list
static Thread *tail; ///< Tail of the thread list static Thread *tail; ///< Tail of the thread list
...@@ -223,5 +220,3 @@ private: ...@@ -223,5 +220,3 @@ private:
} }
#endif // WITH_CPU_TIME_COUNTER #endif // WITH_CPU_TIME_COUNTER
#endif
...@@ -36,14 +36,14 @@ namespace miosix { ...@@ -36,14 +36,14 @@ namespace miosix {
// Declared in kernel.cpp // Declared in kernel.cpp
extern volatile Thread *runningThread; extern volatile Thread *runningThread;
long long CPUTimeCounter::PKwillSwitchContext() long long CPUTimeCounter::IRQwillSwitchContext()
{ {
long long t=IRQgetTime(); long long t=IRQgetTime();
runningThread->timeCounterData.usedCpuTime+=t-runningThread->timeCounterData.lastActivation; runningThread->timeCounterData.usedCpuTime+=t-runningThread->timeCounterData.lastActivation;
return t; return t;
} }
void CPUTimeCounter::PKdidSwitchContext(long long t) void CPUTimeCounter::IRQdidSwitchContext(long long t)
{ {
runningThread->timeCounterData.lastActivation=t; runningThread->timeCounterData.lastActivation=t;
} }
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> * * along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/ ***************************************************************************/
#ifndef CPU_TIME_COUNTER_TYPES_H #pragma once
#define CPU_TIME_COUNTER_TYPES_H
#include "config/miosix_settings.h" #include "config/miosix_settings.h"
...@@ -53,5 +52,3 @@ struct CPUTimeCounterPrivateThreadData ...@@ -53,5 +52,3 @@ struct CPUTimeCounterPrivateThreadData
} }
#endif // WITH_CPU_TIME_COUNTER #endif // WITH_CPU_TIME_COUNTER
#endif
...@@ -135,7 +135,7 @@ public: ...@@ -135,7 +135,7 @@ public:
static void IRQsetIdleThread(Thread *idleThread) static void IRQsetIdleThread(Thread *idleThread)
{ {
#ifdef WITH_CPU_TIME_COUNTER #ifdef WITH_CPU_TIME_COUNTER
CPUTimeCounter::PKaddIdleThread(idleThread); CPUTimeCounter::IRQaddIdleThread(idleThread);
#endif #endif
return T::IRQsetIdleThread(idleThread); return T::IRQsetIdleThread(idleThread);
} }
...@@ -166,11 +166,11 @@ public: ...@@ -166,11 +166,11 @@ public:
static void IRQfindNextThread() static void IRQfindNextThread()
{ {
#ifdef WITH_CPU_TIME_COUNTER #ifdef WITH_CPU_TIME_COUNTER
long long t=CPUTimeCounter::PKwillSwitchContext(); long long t=CPUTimeCounter::IRQwillSwitchContext();
#endif #endif
T::IRQfindNextThread(); T::IRQfindNextThread();
#ifdef WITH_CPU_TIME_COUNTER #ifdef WITH_CPU_TIME_COUNTER
CPUTimeCounter::PKdidSwitchContext(t); CPUTimeCounter::IRQdidSwitchContext(t);
#endif #endif
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment