SLJ Test
1.0
System Latency Jitter Test
|
System Latency Jitter Test. More...
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include "replgetopt.h"
Go to the source code of this file.
Classes | |
struct | args_stct |
struct | bin_stct |
struct | outlier_stct |
Macros | |
#define | _GNU_SOURCE |
#define | SLEEP_SEC(x) sleep(x) |
#define | SLEEP_MSEC(x) |
#define | DEF_BINS 20 |
#define | DEF_CPU NULL |
#define | DEF_OUTFILE NULL |
#define | DEF_KNEE 50 |
#define | DEF_MIN 10 |
#define | DEF_OUTBUF 10000 |
#define | DEF_PAUSE 0 |
#define | DEF_RUNTIME 1 |
#define | DEF_SUM 0 |
#define | DEF_LINEWID 79 |
#define | rdtsc(x) |
Read value of TSC into a uint64_t. | |
#define | ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) |
#define | RET_MAX_LEN 10 /* Maximum length of return string */ |
sprintf() to a malloc()'d string |
Typedefs | |
typedef struct args_stct | args_t |
typedef struct bin_stct | bin_t |
typedef struct outlier_stct | outlier_t |
Functions | |
asprintf (char **ret, const char *format,...) | |
char * | t2ts (uint64_t ticks, double tpns) |
Convert a number of TSC ticks to a time string easily human readable. | |
int | args_parse (int argc, char *argv[]) |
void | outliers_setup () |
Allocate memory and open file for outliers logging. | |
void | histo_setup () |
int | main (int argc, char *argv[]) |
Measure and visualize system latency jitter. |
Variables | |
args_t | args |
struct option | OptTable [] |
const char * | OptString = "b:f:hk:m:o:p:r:sw:" |
const char * | usage = "[-b bins] [-f file] [-h] [-k knee] [-m min] [-o outbuf] [-p pause] [-r runtime] [-s] [-w width]" |
const char * | version = "SLJ Test 1.0" |
bin_t * | histo |
outlier_t * | outbuf = NULL |
FILE * | outfile = NULL |
System Latency Jitter Test.
System Latency Jitter Test - Measure and visualize system latency jitter
See accompanying PDF or HTML renderings of doc, or see doc input at end of this file
Termnology used in the source: Ticks: One tick is the time taken for the Time Stamp Counter (TSC) on x86 processors to advance one count. The inverse of the CPU clock frequency is the time taken for one TSC tick in seconds.
Timestamp: One reading of TSC.
Block of timestamps: Timestamps taken in sequence to keep control flow uninterupted by branches. Statistics and logging are done after the block. This maximizes cache hit rates and keeps the CPU executing at full speed.
Delta: The difference between the TSC on two sequential readings.
Bin: One entry in the histogram table
Knee: The midpoint in the number of histogram bins: 1/2 the bins below the knee, 1/2 the bins above the knee. Bins spacing steps linearaly below the knee and exponentially above it.
ToDo Taskset CPU affiinity Maybe option to run many threads at once? Better comments on data structures and algoriths Break up main() so it's not so long
(c) Copyright 2011, 2012 Informatica Corp. Robert A. Van Valzah, October 2011, February 2012, October 2012
Acknowledgements Inspired by David Riddoch of Solarflare Idea for -s
flag to sum deltas into histogram bins instead of just counting them from Erez Strauss
License Redistribution and use in source and binary forms, with or without modification, are permitted without restriction. The author will be disappointed if you use this software for making war, mulching babies, or improving systems running competing messaging software.
Disclaimers
THE SOFTWARE IS PROVIDED "AS IS" AND INFORMATICA DISCLAIMS ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. INFORMATICA DOES NOT WARRANT THAT USE OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE. INFORMATICA SHALL NOT, UNDER ANY CIRCUMSTANCES, BE LIABLE TO LICENSEE FOR LOST PROFITS, CONSEQUENTIAL, INCIDENTAL, SPECIAL OR INDIRECT DAMAGES ARISING OUT OF OR RELATED TO THIS AGREEMENT OR THE TRANSACTIONS CONTEMPLATED HEREUNDER, EVEN IF INFORMATICA HAS BEEN APPRISED OF THE LIKELIHOOD OF SUCH DAMAGES.
Definition in file sljtest.c.
#define _GNU_SOURCE |
Has side effect of declaring asprintf()
#define ARRAY_SIZE | ( | a | ) | (sizeof(a)/sizeof(a[0])) |
#define DEF_PAUSE 0 |
#define rdtsc | ( | x | ) |
#define RET_MAX_LEN 10 /* Maximum length of return string */ |
sprintf() to a malloc()'d string
ret | Pointer to char * where output string will be returned |
format | printf()-style format string |
... | Optional arguments a la printf() |
Our own hack version of asprintf() for platforms that don't have it. I'm looking at you Solaris.
#define SLEEP_MSEC | ( | x | ) |
typedef struct outlier_stct outlier_t |
Type for outlier buffer entry
int main | ( | int | argc, |
char * | argv[] | ||
) |
void outliers_setup | ( | ) |
char* t2ts | ( | uint64_t | ticks, |
double | tpns | ||
) |
Convert a number of TSC ticks to a time string easily human readable.
ticks | Ticks to be converted. |
tpns | Ticks per nanosecond as measured for this system. |
Value is scaled to nanoseconds, microseconds, milliseconds, or seconds. Returns a malloc()'d string, so caller must free() or leak.
args_t args |
Command line argument values
struct option OptTable[] |
Command line options for getopt()
const char* usage = "[-b bins] [-f file] [-h] [-k knee] [-m min] [-o outbuf] [-p pause] [-r runtime] [-s] [-w width]" |