PatchworkOS  28a9544
A non-POSIX operating system.
Loading...
Searching...
No Matches
perf.c File Reference
#include <kernel/drivers/perf.h>
#include <kernel/cpu/cpu.h>
#include <kernel/fs/file.h>
#include <kernel/fs/sysfs.h>
#include <kernel/fs/vfs.h>
#include <kernel/log/panic.h>
#include <kernel/mem/pmm.h>
#include <kernel/sched/sched.h>
#include <kernel/sched/sys_time.h>
#include <kernel/sched/timer.h>
#include <kernel/sync/lock.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>
#include <sys/list.h>
#include <sys/math.h>

Go to the source code of this file.

Functions

static uint64_t perf_cpu_read (file_t *file, void *buffer, uint64_t count, uint64_t *offset)
 
static uint64_t perf_mem_read (file_t *file, void *buffer, uint64_t count, uint64_t *offset)
 
void perf_cpu_ctx_init (perf_cpu_ctx_t *ctx)
 Initializes a per-CPU performance context, must be called on the CPU that owns the context.
 
void perf_process_ctx_init (perf_process_ctx_t *ctx)
 Initializes a per-process performance context.
 
void perf_thread_ctx_init (perf_thread_ctx_t *ctx)
 Initializes a per-thread performance context.
 
void perf_init (void)
 Initializes the performance driver.
 
void perf_interrupt_begin (cpu_t *self)
 Called at the beginning of an interrupt to update cpu performance data.
 
void perf_interrupt_end (cpu_t *self)
 Called at the end of an interrupt to update cpu performance data.
 
void perf_syscall_begin (void)
 Called at the beginning of a syscall to update process performance data.
 
void perf_syscall_end (void)
 Called at the end of a syscall to update process performance data.
 

Variables

static dentry_tperfDir = NULL
 
static dentry_tcpuFile = NULL
 
static dentry_tmemFile = NULL
 
static file_ops_t cpuOps
 
static file_ops_t memOps
 

Function Documentation

◆ perf_cpu_read()

◆ perf_mem_read()

static uint64_t perf_mem_read ( file_t file,
void *  buffer,
uint64_t  count,
uint64_t offset 
)
static

Variable Documentation

◆ cpuFile

dentry_t* cpuFile = NULL
static

Definition at line 22 of file perf.c.

Referenced by perf_init().

◆ cpuOps

file_ops_t cpuOps
static
Initial value:
= {
.read = perf_cpu_read,
}
static uint64_t perf_cpu_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
Definition perf.c:25

Definition at line 76 of file perf.c.

Referenced by perf_init().

◆ memFile

dentry_t* memFile = NULL
static

Definition at line 23 of file perf.c.

Referenced by perf_init().

◆ memOps

file_ops_t memOps
static
Initial value:
= {
.read = perf_mem_read,
}
static uint64_t perf_mem_read(file_t *file, void *buffer, uint64_t count, uint64_t *offset)
Definition perf.c:80

Definition at line 104 of file perf.c.

Referenced by perf_init().

◆ perfDir

dentry_t* perfDir = NULL
static

Definition at line 21 of file perf.c.

Referenced by perf_init().