-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
1,102 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.o | ||
oslat | ||
cscope* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
ifndef CFLAGS | ||
CFLAGS = -O2 -Wall | ||
endif | ||
|
||
INCLUDE += -I. | ||
LDFLAGS += -lpthread -lnuma | ||
|
||
is_ppc := $(shell (uname -m || uname -p) | grep ppc) | ||
is_x86 := $(shell (uname -m || uname -p) | grep i.86) | ||
is_x86_64 := $(shell (uname -m || uname -p) | grep x86_64) | ||
|
||
ifneq ($(is_x86),) | ||
# Need to tell gcc we have a reasonably recent cpu to get the atomics. | ||
CFLAGS += -march=i686 | ||
endif | ||
|
||
all: oslat | ||
|
||
oslat: main.o rt-utils.o error.o trace.o | ||
$(CC) -o $@ $(LDFLAGS) $^ | ||
|
||
clean: | ||
rm -f *.o oslat cscope.* | ||
|
||
cscope: | ||
cscope -bq *.c |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
oslat - A OS Latency Detector | ||
========== | ||
|
||
Introduction | ||
------------ | ||
|
||
This is a test program for detecting OS level thread latency caused by | ||
unexpected system scheduling or interruptions (e.g., system ticks). | ||
|
||
Please run this program using root, or make sure you have the required | ||
privileges for e.g. setting schedule priorities or doing memory locks. | ||
|
||
Major features: | ||
|
||
- Poll-based busy loop, doing RDTSC on specified cores. By default, it'll | ||
launch a test thread on all cores | ||
- Collect interruptions (in microseconds) and put into per-us baskets | ||
- Supports CPU-list (libnuma), FIFO priority, and multi-threading | ||
- Little memory footprint | ||
- Supports ftrace | ||
|
||
TODO: | ||
|
||
- Calculate these factors (per-core): mean, variance | ||
|
||
Sample output | ||
------------- | ||
|
||
This is a sample output of running oslat on a real-time virtual machine (core | ||
2-9 isolated) for 1 hour: | ||
|
||
[root@localhost ~]# ./oslat --cpu-list 2,3,4,5,6,7,8,9 --rtprio 1 --runtime 3600 | ||
|
||
Version: v0.1.0 | ||
|
||
core_i: 2 3 4 5 6 7 8 9 | ||
cpu_mhz: 2197 2197 2197 2197 2197 2197 2197 2197 | ||
001 (us): 93068541026 93068541249 93068541429 93068541411 93068541565 93068541296 93068541320 93068541409 | ||
002 (us): 51 51 51 51 51 51 51 51 | ||
003 (us): 2 2 2 2 2 2 2 2 | ||
004 (us): 4 4 8 3 26 3 4 2 | ||
005 (us): 40 39 35 41 18 42 40 41 | ||
006 (us): 1 1 1 0 0 0 1 1 | ||
007 (us): 0 0 0 0 0 0 0 0 | ||
008 (us): 0 0 0 0 0 0 0 0 | ||
009 (us): 0 0 0 0 0 0 0 0 | ||
010 (us): 0 0 0 0 0 0 0 0 | ||
011 (us): 0 0 0 0 0 0 0 0 | ||
012 (us): 0 0 0 0 0 0 0 0 | ||
013 (us): 0 0 0 0 0 0 0 0 | ||
014 (us): 0 0 0 0 0 0 0 0 | ||
015 (us): 0 0 0 0 0 0 0 0 | ||
016 (us): 0 0 0 0 0 0 0 0 | ||
017 (us): 0 0 0 0 0 0 0 0 | ||
018 (us): 0 0 0 0 0 0 0 0 | ||
019 (us): 0 0 0 0 0 0 0 0 | ||
020 (us): 0 0 0 0 0 0 0 0 | ||
021 (us): 0 0 0 0 0 0 0 0 | ||
022 (us): 0 0 0 0 0 0 0 0 | ||
023 (us): 0 0 0 0 0 0 0 0 | ||
024 (us): 0 0 0 0 0 0 0 0 | ||
025 (us): 0 0 0 0 0 0 0 0 | ||
026 (us): 0 0 0 0 0 0 0 0 | ||
027 (us): 0 0 0 0 0 0 0 0 | ||
028 (us): 0 0 0 0 0 0 0 0 | ||
029 (us): 0 0 0 0 0 0 0 0 | ||
030 (us): 0 0 0 0 0 0 0 0 | ||
031 (us): 0 0 0 0 0 0 0 0 | ||
032 (us): 0 0 0 0 0 0 0 0 | ||
maxlat: 6 6 6 5 5 5 6 6 (us) | ||
runtime: 3600.740 3600.740 3600.740 3600.740 3600.740 3600.740 3600.740 3600.740 (sec) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
/* | ||
* Copyright (C) 2009 John Kacur <[email protected]> | ||
* | ||
* error routines, similar to those found in | ||
* Advanced Programming in the UNIX Environment 2nd ed. | ||
*/ | ||
#include "error.h" | ||
|
||
/* Print an error message, plus a message for err and exit with error err */ | ||
void err_exit(int err, char *fmt, ...) | ||
{ | ||
va_list ap; | ||
va_start(ap, fmt); | ||
err_doit(err, fmt, ap); | ||
va_end(ap); | ||
exit(err); | ||
} | ||
|
||
/* print an error message and return */ | ||
void err_msg(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
va_start(ap, fmt); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
return; | ||
} | ||
|
||
/* Print an error message, plus a message for err, and return */ | ||
void err_msg_n(int err, char *fmt, ...) | ||
{ | ||
va_list ap; | ||
va_start(ap, fmt); | ||
err_doit(err, fmt, ap); | ||
va_end(ap); | ||
return; | ||
} | ||
|
||
/* print an error message and quit */ | ||
void err_quit(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
va_start(ap, fmt); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
exit(1); | ||
} | ||
|
||
void debug(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
|
||
va_start(ap, fmt); | ||
fputs("DEBUG: ", stderr); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
} | ||
|
||
void info(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
|
||
va_start(ap, fmt); | ||
fputs("INFO: ", stderr); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
} | ||
|
||
void warn(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
|
||
va_start(ap, fmt); | ||
fputs("WARN: ", stderr); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
} | ||
|
||
void fatal(char *fmt, ...) | ||
{ | ||
va_list ap; | ||
|
||
va_start(ap, fmt); | ||
fputs("FATAL: ", stderr); | ||
err_doit(0, fmt, ap); | ||
va_end(ap); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
void err_doit(int err, const char *fmt, va_list ap) | ||
{ | ||
vfprintf(stderr, fmt, ap); | ||
if (err) | ||
fprintf(stderr, ": %s\n", strerror(err)); | ||
return; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#ifndef __ERROR_H | ||
#define __ERROR_H | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdarg.h> | ||
#include <string.h> | ||
|
||
void err_exit(int err, char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
void err_msg(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void err_msg_n(int err, char *fmt, ...) __attribute__((format(printf, 2, 3))); | ||
void err_quit(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void debug(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void info(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void warn(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void fatal(char *fmt, ...) __attribute__((format(printf, 1, 2))); | ||
void err_doit(int err, const char *fmt, va_list ap); | ||
|
||
#endif /* __ERROR_H */ |
Oops, something went wrong.