mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Added GetSchedulerTicks()
This commit is contained in:
parent
a21c2063ae
commit
47a10df568
@ -445,6 +445,7 @@ namespace Tasking
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CPU::x64::writecr3({.raw = (uint64_t)KernelPageTable}); /* Restore kernel page table for safety reasons. */
|
CPU::x64::writecr3({.raw = (uint64_t)KernelPageTable}); /* Restore kernel page table for safety reasons. */
|
||||||
|
uint64_t SchedTmpTicks = CPU::Counter();
|
||||||
CPUData *CurrentCPU = GetCurrentCPU();
|
CPUData *CurrentCPU = GetCurrentCPU();
|
||||||
schedbg("Scheduler called on CPU %d.", CurrentCPU->ID);
|
schedbg("Scheduler called on CPU %d.", CurrentCPU->ID);
|
||||||
schedbg("%d: %ld%%", CurrentCPU->ID, GetUsage(CurrentCPU->ID));
|
schedbg("%d: %ld%%", CurrentCPU->ID, GetUsage(CurrentCPU->ID));
|
||||||
@ -635,6 +636,7 @@ namespace Tasking
|
|||||||
|
|
||||||
/* RealEnd->[Function Exit] */
|
/* RealEnd->[Function Exit] */
|
||||||
RealEnd:
|
RealEnd:
|
||||||
|
this->SchedulerTicks.Store(CPU::Counter() - SchedTmpTicks);
|
||||||
__sync_synchronize(); /* TODO: Is this really needed? */
|
__sync_synchronize(); /* TODO: Is this really needed? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ namespace Tasking
|
|||||||
|
|
||||||
void Task::WaitForProcess(PCB *pcb)
|
void Task::WaitForProcess(PCB *pcb)
|
||||||
{
|
{
|
||||||
if (!pcb)
|
if (InvalidPCB(pcb))
|
||||||
return;
|
return;
|
||||||
if (pcb->Status == TaskStatus::UnknownStatus)
|
if (pcb->Status == TaskStatus::UnknownStatus)
|
||||||
return;
|
return;
|
||||||
@ -232,7 +232,7 @@ namespace Tasking
|
|||||||
|
|
||||||
void Task::WaitForThread(TCB *tcb)
|
void Task::WaitForThread(TCB *tcb)
|
||||||
{
|
{
|
||||||
if (!tcb)
|
if (InvalidTCB(tcb))
|
||||||
return;
|
return;
|
||||||
if (tcb->Status == TaskStatus::UnknownStatus)
|
if (tcb->Status == TaskStatus::UnknownStatus)
|
||||||
return;
|
return;
|
||||||
@ -243,7 +243,7 @@ namespace Tasking
|
|||||||
|
|
||||||
void Task::WaitForProcessStatus(PCB *pcb, TaskStatus status)
|
void Task::WaitForProcessStatus(PCB *pcb, TaskStatus status)
|
||||||
{
|
{
|
||||||
if (!pcb)
|
if (InvalidPCB(pcb))
|
||||||
return;
|
return;
|
||||||
if (pcb->Status == TaskStatus::UnknownStatus)
|
if (pcb->Status == TaskStatus::UnknownStatus)
|
||||||
return;
|
return;
|
||||||
@ -254,7 +254,7 @@ namespace Tasking
|
|||||||
|
|
||||||
void Task::WaitForThreadStatus(TCB *tcb, TaskStatus status)
|
void Task::WaitForThreadStatus(TCB *tcb, TaskStatus status)
|
||||||
{
|
{
|
||||||
if (!tcb)
|
if (InvalidTCB(tcb))
|
||||||
return;
|
return;
|
||||||
if (tcb->Status == TaskStatus::UnknownStatus)
|
if (tcb->Status == TaskStatus::UnknownStatus)
|
||||||
return;
|
return;
|
||||||
@ -835,6 +835,7 @@ namespace Tasking
|
|||||||
|
|
||||||
Task::~Task()
|
Task::~Task()
|
||||||
{
|
{
|
||||||
|
debug("Destructor called");
|
||||||
SmartCriticalSection(TaskingLock);
|
SmartCriticalSection(TaskingLock);
|
||||||
trace("Stopping tasking");
|
trace("Stopping tasking");
|
||||||
foreach (PCB *Process in ListProcess)
|
foreach (PCB *Process in ListProcess)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <symbols.hpp>
|
#include <symbols.hpp>
|
||||||
#include <vector.hpp>
|
#include <vector.hpp>
|
||||||
#include <memory.hpp>
|
#include <memory.hpp>
|
||||||
|
#include <atomic.hpp>
|
||||||
#include <ipc.hpp>
|
#include <ipc.hpp>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <abi.h>
|
#include <abi.h>
|
||||||
@ -228,6 +229,7 @@ namespace Tasking
|
|||||||
Vector<PCB *> ListProcess;
|
Vector<PCB *> ListProcess;
|
||||||
PCB *IdleProcess = nullptr;
|
PCB *IdleProcess = nullptr;
|
||||||
TCB *IdleThread = nullptr;
|
TCB *IdleThread = nullptr;
|
||||||
|
Atomic<uint64_t> SchedulerTicks = 0;
|
||||||
|
|
||||||
bool InvalidPCB(PCB *pcb);
|
bool InvalidPCB(PCB *pcb);
|
||||||
bool InvalidTCB(TCB *tcb);
|
bool InvalidTCB(TCB *tcb);
|
||||||
@ -260,6 +262,7 @@ namespace Tasking
|
|||||||
bool StopScheduler = false;
|
bool StopScheduler = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
uint64_t GetSchedulerTicks() { return SchedulerTicks.Load(); }
|
||||||
Vector<PCB *> GetProcessList() { return ListProcess; }
|
Vector<PCB *> GetProcessList() { return ListProcess; }
|
||||||
Security *GetSecurityManager() { return &SecurityManager; }
|
Security *GetSecurityManager() { return &SecurityManager; }
|
||||||
void Panic() { StopScheduler = true; }
|
void Panic() { StopScheduler = true; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user