#include "devices/timer.h"
#include <debug.h>
#include <inttypes.h>
#include <round.h>
#include <stdio.h>
#include "devices/pit.h"
#include "threads/interrupt.h"
#include "threads/synch.h"
#include "threads/thread.h"
Go to the source code of this file.
Functions | |
static bool | too_many_loops (unsigned loops) |
static void | busy_wait (int64_t loops) |
static void | real_time_sleep (int64_t num, int32_t denom) |
static void | real_time_delay (int64_t num, int32_t denom) |
void | timer_init (void) |
void | timer_calibrate (void) |
int64_t | timer_ticks (void) |
int64_t | timer_elapsed (int64_t then) |
void | timer_sleep (int64_t ticks) |
void | timer_msleep (int64_t ms) |
void | timer_usleep (int64_t us) |
void | timer_nsleep (int64_t ns) |
void | timer_mdelay (int64_t ms) |
void | timer_udelay (int64_t us) |
void | timer_ndelay (int64_t ns) |
void | timer_print_stats (void) |
static void | timer_interrupt (struct intr_frame *args UNUSED) |
Variables | |
static int64_t | ticks |
static unsigned | loops_per_tick |
static intr_handler_func | timer_interrupt |
static void NO_INLINE busy_wait | ( | int64_t | loops | ) | [static] |
Definition at line 206 of file timer.c.
References barrier.
Referenced by real_time_delay(), and too_many_loops().
Definition at line 242 of file timer.c.
References ASSERT, busy_wait(), loops_per_tick, and TIMER_FREQ.
Referenced by real_time_sleep(), timer_mdelay(), timer_ndelay(), and timer_udelay().
Definition at line 214 of file timer.c.
References ASSERT, intr_get_level(), INTR_ON, real_time_delay(), ticks, TIMER_FREQ, and timer_sleep().
Referenced by timer_msleep(), timer_nsleep(), and timer_usleep().
void timer_calibrate | ( | void | ) |
Definition at line 45 of file timer.c.
References ASSERT, intr_get_level(), INTR_ON, loops_per_tick, printf(), PRIu64, TIMER_FREQ, and too_many_loops().
Referenced by main().
Definition at line 84 of file timer.c.
References timer_ticks().
Referenced by alarm_priority_thread(), block_thread(), load_thread(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_1(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_mlfqs_recent_1(), and timer_sleep().
void timer_init | ( | void | ) |
Definition at line 37 of file timer.c.
References intr_register_ext(), pit_configure_channel(), TIMER_FREQ, and timer_interrupt.
Referenced by main().
static void timer_interrupt | ( | struct intr_frame *args | UNUSED | ) | [static] |
void timer_mdelay | ( | int64_t | ms | ) |
void timer_msleep | ( | int64_t | ms | ) |
Definition at line 104 of file timer.c.
References real_time_sleep().
Referenced by reset_channel(), speaker_beep(), uhci_enable_port(), uhci_stall_watchdog(), and wait_while_busy().
void timer_ndelay | ( | int64_t | ns | ) |
void timer_nsleep | ( | int64_t | ns | ) |
Definition at line 120 of file timer.c.
References real_time_sleep().
Referenced by select_device().
void timer_print_stats | ( | void | ) |
Definition at line 166 of file timer.c.
References PRId64, printf(), and timer_ticks().
Referenced by print_stats().
void timer_sleep | ( | int64_t | ticks | ) |
Definition at line 92 of file timer.c.
References ASSERT, intr_get_level(), INTR_ON, start, thread_yield(), timer_elapsed(), and timer_ticks().
Referenced by alarm_priority_thread(), load_thread(), real_time_sleep(), sleeper(), test_alarm_negative(), test_alarm_zero(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_1(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_mlfqs_recent_1(), and test_sleep().
int64_t timer_ticks | ( | void | ) |
Definition at line 72 of file timer.c.
References barrier, intr_disable(), intr_set_level(), and ticks.
Referenced by alarm_priority_thread(), block_thread(), load_thread(), sleeper(), test_alarm_priority(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_1(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_mlfqs_recent_1(), test_sleep(), timer_elapsed(), timer_print_stats(), and timer_sleep().
void timer_udelay | ( | int64_t | us | ) |
void timer_usleep | ( | int64_t | us | ) |
Definition at line 112 of file timer.c.
References real_time_sleep().
Referenced by reset_channel(), uhci_enable_port(), uhci_init(), and wait_until_idle().
static bool too_many_loops | ( | unsigned | loops | ) | [static] |
Definition at line 182 of file timer.c.
References barrier, busy_wait(), start, and ticks.
Referenced by timer_calibrate().
unsigned loops_per_tick [static] |
Definition at line 22 of file timer.c.
Referenced by real_time_sleep(), timer_interrupt(), timer_ticks(), and too_many_loops().
intr_handler_func timer_interrupt [static] |