This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================= | |
// XNU kperf/kpc demo | |
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges | |
// | |
// | |
// Demo 1 (profile a function in current thread): | |
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database. | |
// For M1 (Pro/Max), the database file is '/usr/share/kpep/a14.plist'. | |
// 2. Select a few events that you are interested in, | |
// add their names to the `profile_events` array below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Based the following two code bases: | |
- Berkeley's CS188 pacman project code | |
http://ai.berkeley.edu/ | |
- Victor Mayoral Vilches's RL tutorial | |
https://github.com/vmayoral/basic_reinforcement_learning | |
@author: Heechul Yun ([email protected]) | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/linux/sched.h b/include/linux/sched.h | |
index 4a1f493..ef258ef 100644 | |
--- a/include/linux/sched.h | |
+++ b/include/linux/sched.h | |
@@ -1179,6 +1179,10 @@ struct sched_entity { | |
u64 exec_start; | |
u64 sum_exec_runtime; | |
u64 vruntime; | |
+#ifdef CONFIG_CFS_BVT | |
+ u64 effective_vruntime; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ps -eo pri,nice,rtprio,pid,psr,comm | sort -n | |
PRI NI RTPRIO PID PSR COMMAND | |
14 5 - 31 3 ksmd | |
18 1 - 2301 0 rtkit-daemon | |
19 0 - 1001 1 upstart-socket- | |
19 0 - 1069 0 dbus-daemon | |
19 0 - 1092 2 bluetoothd | |
... | |
... | |
39 -20 - 782 2 iwlwifi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline void arch_spin_unlock(arch_spinlock_t *lock) | |
{ | |
1: smp_mb(); | |
__asm__ __volatile__( | |
2:" str %1, [%0]\n" | |
: | |
: "r" (&lock->lock), "r" (0) | |
: "cc"); | |
3: dsb_sev(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static inline void arch_spin_lock(arch_spinlock_t *lock) | |
{ | |
unsigned long tmp; | |
__asm__ __volatile__( | |
1: "1: ldrex %0, [%1]\n" | |
2: " teq %0, #0\n" | |
3: WFE("ne") | |
4: " strexeq %0, %2, [%1]\n" | |
5: " teqeq %0, #0\n" | |
6: " bne 1b" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct irq_work { | |
unsigned long flags; | |
struct llist_node llnode; | |
void (*func)(struct irq_work *); | |
}; | |
static inline | |
void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct irq_work { | |
unsigned long flags; | |
struct llist_node llnode; | |
void (*func)(struct irq_work *); | |
}; | |
static inline | |
void init_irq_work(struct irq_work *work, void (*func)(struct irq_work *)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> | |
#include <sys/time.h> | |
#define USECREQ 250 | |
#define LOOPS 1000 |