Go to the source code of this file.
Functions | |
static void | StopApplication (int sig __attribute__((unused))) |
static void | DisplayProgramHeader (void) |
static void | DisplayProgramFooter (void) |
static void | PrintTimeStamp (uint64_t ts) |
Print a human readable time on the screen. More... | |
static uint64_t | CalcOffset (uint64_t ts_start, uint64_t ts1, uint64_t ts2) |
Calculate the transmit offset. More... | |
static NtError_t | GetAdapterTimestamp (int adapterNo, uint64_t *ts) |
Gets the timestamp from the adapter. More... | |
static NtError_t | SetGlobalSync (int adapterNo, uint32_t portMask, uint64_t offset) |
Sets Global Sync. More... | |
static int | GetTimeStamp (uint64_t *ts) |
Get the timestamp of the first packet in the file. More... | |
static int | ParseStartTime (const char *dts, uint64_t *ts) |
Parse the start time. More... | |
static int | printTransmissionStart (int adapter, uint64_t firstTS, uint64_t offset) |
Print the transmission start time on the screen. More... | |
int | main (int argc, const char *argv[]) |
Macros | |
#define | OPTION_FILE (1<<1) |
#define | OPTION_PORTOFFSET (1<<2) |
#define | OPTION_GSYNC (1<<3) |
#define | OPTION_START (1<<4) |
#define | OPTION_TIMESTAMP (1<<5) |
Variables | |
static const char * | usageText [] |
static char * | opt_file = NULL |
static int | opt_portOffset = -1 |
static char * | opt_start = NULL |
static int | opt_time = 0 |
static int | appRunning =1 |
static const char * | progname |
Program name for the program itself. More... | |
static uint32_t | optionMask = 0 |
static uint64_t | gsyncAdapterTS = 0 |
The timestamp of the adapter. More... | |
static uint64_t | gsyncFirstTS = 0 |
The timestamp of the first packet in the file. More... | |
static uint64_t | gsyncSyncTS = 0 |
The timestamp of the oldset timestamp of all the files that it sent synchronized. More... | |
static uint64_t | gsyncStartTime = 0 |
The start time for the transmit to begin. More... | |
static uint64_t | gsyncOffset = 0 |
The calculated transmit delay. More... | |
static uint64_t | gsyncMaxTS = 0 |
The timestamp of the last packet in the file. Used to calculate when the transmit is finish. More... | |
static int | gsyncAdapter = 0 |
The adapter number for the adapter used to transmit the file. More... | |
struct argparse_option | arg_options [] |
Function Documentation
|
static |
Definition at line 230 of file replayGS_example.c.
Referenced by main().
|
static |
Definition at line 245 of file replayGS_example.c.
Referenced by main().
|
static |
Definition at line 260 of file replayGS_example.c.
Referenced by main().
|
static |
Print a human readable time on the screen.
This function is called to print a human readable time on the screen. Mainly used to print the transmit start time.
- Parameters
-
[in] ts The timestamp to print
- Return values
-
NT_SUCCESS Function succeded != NT_SUCCESS Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 277 of file replayGS_example.c.
Referenced by printTransmissionStart().
|
static |
Calculate the transmit offset.
This function is called to calculate the transmit offset. CalcOffset calculates the global offset to set on an adapter in global sync mode. The clocks of the adapters used must be synchronized. All time stamps supplieds as parameters must be in 10-ns ticks. The offset is calculated such that transmission starts on ts_start.
The adapter implements the following logic in GSYNC mode. Let Tp denote the time stamp of a packet, t the current (running) time, and offset the GSYNC offset in the adapter.
Tp > t + offset : wait, do not send the packet yet Tp <= t + offset : send the packet
Replay calculates gsyncOffset a little differently, namely as
t - Tp = gsyncOffset
and hence
Tp = -gsyncOffset + t
If we insert this last equation into the right-hand side of the expression used in the adapter (Tp = t + offset), we get
Tp = t + offset = -gsyncOffset + t
and therefore
offset = -gsyncOffset
ReplayGS therefore uses the negated value of gsyncOffset as the offset value on the adapter.
- Parameters
-
[in] ts_start The start time of the transmit [in] ts1 Timestamp 1 from either the local file or from a file sent from another server [in] ts2 Timestamp 2 from either the local file or from a file sent from another server
- Return values
-
NT_SUCCESS Function succeded != NT_SUCCESS Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 338 of file replayGS_example.c.
Referenced by main().
|
static |
Gets the timestamp from the adapter.
This function is called to get the adapter timestamp
- Parameters
-
[in] adapterNo Adapter number to get timestamp from [out] ts Pointer to the timestamp
- Return values
-
NT_SUCCESS Function succeded != NT_SUCCESS Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 359 of file replayGS_example.c.
Referenced by main(), and printTransmissionStart().
|
static |
Sets Global Sync.
This function is called to enable or disable global sync
- Parameters
-
[in] adapterNo Adapter number to get timestamp from [in] portMask Bitmask for ports to enable [in] offset Global sync offset
- Return values
-
NT_SUCCESS Function succeded != NT_SUCCESS Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 407 of file replayGS_example.c.
Referenced by main().
|
static |
Get the timestamp of the first packet in the file.
This function is called to get the timestamp of the first packet in the file
- Parameters
-
[out] ts Pointer to variable holding the timestamp
- Return values
-
0 Function succeded 1 Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 457 of file replayGS_example.c.
Referenced by main().
|
static |
Parse the start time.
This function is called to parse the start time entered as input option
- Parameters
-
[in] dts Pointer to string containing the start time [out] ts Pointer to variable to hold the converted start time
- Return values
-
0 Function succeded -1 Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 507 of file replayGS_example.c.
Referenced by main().
|
static |
Print the transmission start time on the screen.
This function is called to print the transmission start time on the screen.
- Parameters
-
[in] adapter Adapter number [in] firstTS The time stamp of the first packet in the file [in] offset The calculated transmit offset
- Return values
-
NT_SUCCESS Function succeded != NT_SUCCESS Function failed
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 574 of file replayGS_example.c.
Referenced by main().
int main | ( | int | argc, |
const char * | argv[] | ||
) |
Definition at line 594 of file replayGS_example.c.
Macro Definition Documentation
#define OPTION_FILE (1<<1) |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 202 of file replayGS_example.c.
Referenced by main().
#define OPTION_PORTOFFSET (1<<2) |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 203 of file replayGS_example.c.
Referenced by main().
#define OPTION_GSYNC (1<<3) |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 204 of file replayGS_example.c.
Referenced by main().
#define OPTION_START (1<<4) |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 205 of file replayGS_example.c.
Referenced by main().
#define OPTION_TIMESTAMP (1<<5) |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 206 of file replayGS_example.c.
Referenced by main().
Variable Documentation
|
static |
Definition at line 167 of file replayGS_example.c.
Referenced by main().
|
static |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 181 of file replayGS_example.c.
Referenced by GetTimeStamp(), and main().
|
static |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 182 of file replayGS_example.c.
Referenced by main().
|
static |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 183 of file replayGS_example.c.
Referenced by main().
|
static |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 184 of file replayGS_example.c.
Referenced by main().
|
static |
Definition at line 186 of file replayGS_example.c.
Referenced by main(), and StopApplication().
|
static |
Program name for the program itself.
Definition at line 187 of file replayGS_example.c.
Referenced by DisplayProgramHeader(), and main().
|
static |
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 189 of file replayGS_example.c.
Referenced by main().
|
static |
The timestamp of the adapter.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 191 of file replayGS_example.c.
Referenced by main().
|
static |
The timestamp of the first packet in the file.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 192 of file replayGS_example.c.
Referenced by main().
|
static |
The timestamp of the oldset timestamp of all the files that it sent synchronized.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 193 of file replayGS_example.c.
Referenced by main().
|
static |
The start time for the transmit to begin.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 194 of file replayGS_example.c.
Referenced by main().
|
static |
The calculated transmit delay.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 195 of file replayGS_example.c.
Referenced by main().
|
static |
The timestamp of the last packet in the file. Used to calculate when the transmit is finish.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 196 of file replayGS_example.c.
Referenced by main().
|
static |
The adapter number for the adapter used to transmit the file.
- Examples:
- net/replayGS/replayGS_example.c.
Definition at line 197 of file replayGS_example.c.
Referenced by main().
struct argparse_option arg_options[] |
Table of valid options.
Definition at line 211 of file replayGS_example.c.