Commit 5098855c authored by Andreas Schmidt's avatar Andreas Schmidt

Add timestamps for SendPacket.

parent 28cb3946
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,11 +10,11 @@
* might remain zero
*/
typedef union XlapTimestamp {
struct XlapActualTimestamp {
uint64_t c;
struct timespec t;
} actual;
char _cacheline[64];
struct XlapActualTimestamp {
uint64_t c;
struct timespec t;
} actual;
char _cacheline[64];
} XlapTimestamp;
#include "pp.h"
......@@ -23,29 +23,31 @@ typedef union XlapTimestamp {
* Comma-separated list of timestamp IDs
*/
#define TIMESTAMP_ID_LIST \
PrrtSendStart, \
PrrtSendEnd, \
PrrtSubmitPackage, \
PrrtEncodeStart, \
PrrtEncodeEnd, \
PrrtTransmitStart, \
PrrtTransmitEnd, \
LinkTransmitStart, \
LinkTransmitEnd, \
ChannelTransmit, \
ChannelReceive, \
LinkReceive, \
DecodeStart, \
DecodeEnd, \
HandlePacketStart, \
HandlePacketEnd, \
CopyOutputStart, \
CopyOutputEnd, \
SendFeedbackStart, \
SendFeedbackEnd, \
PrrtReturnPackage, \
PrrtReceivePackage, \
PrrtDeliver \
PrrtSendStart, \
PrrtSendEnd, \
PrrtSubmitPackage, \
PrrtEncodeStart, \
PrrtEncodeEnd, \
PrrtTransmitStart, \
PrrtTransmitEnd, \
PrrtSendPacketStart, \
PrrtSendPacketEnd, \
LinkTransmitStart, \
LinkTransmitEnd, \
ChannelTransmit, \
ChannelReceive, \
LinkReceive, \
DecodeStart, \
DecodeEnd, \
HandlePacketStart, \
HandlePacketEnd, \
CopyOutputStart, \
CopyOutputEnd, \
SendFeedbackStart, \
SendFeedbackEnd, \
PrrtReturnPackage, \
PrrtReceivePackage, \
PrrtDeliver \
#define TIMESSTAMP_ID_TO_NAME(id) ts_##id
......@@ -53,24 +55,24 @@ typedef union XlapTimestamp {
* enum containing all timestamp IDs
*/
typedef enum XlapTimestampId {
PP_foreach(PP_join_comma, TIMESSTAMP_ID_TO_NAME, TIMESTAMP_ID_LIST),
ts_count
PP_foreach(PP_join_comma, TIMESSTAMP_ID_TO_NAME, TIMESTAMP_ID_LIST),
ts_count
} XlapTimestampId;
/*
* enum to distinguish between data and redundancy packet timstamps
*/
typedef enum XlapTimestampPacketKind {
ts_data_packet = 0,
ts_any_packet = 0,
ts_redundancy_packet = 1,
ts_data_packet = 0,
ts_any_packet = 0,
ts_redundancy_packet = 1,
} XlapTimestampPacketKind;
/*
* Table that stores timestamps for each timestamp ID
*/
typedef struct XlapTimestampTableRow {
XlapTimestamp time[ts_count];
XlapTimestamp time[ts_count];
} XlapTimestampTableRow;
/*
......@@ -84,23 +86,23 @@ typedef struct XlapTimestampTableRow {
* Table that stores timestamp table rows
*/
#ifdef XLAP
typedef struct XlapTimestampTable {
XlapTimestampTableRow rows[TS_ROWS];
} XlapTimestampTable;
typedef struct XlapTimestampTable {
XlapTimestampTableRow rows[TS_ROWS];
} XlapTimestampTable;
#else /* XLAP */
typedef char XlapTimestampTable;
typedef char XlapTimestampTable;
#endif
/*
* Dummy data structure to store a single timestamp table row.
*/
#ifdef XLAP
typedef struct XlapTimestampPlaceholder {
_Atomic(XlapTimestampTable *) tstable[1];
XlapTimestampTableRow rows[1];
} XlapTimestampPlaceholder;
typedef struct XlapTimestampPlaceholder {
_Atomic(XlapTimestampTable *) tstable[1];
XlapTimestampTableRow rows[1];
} XlapTimestampPlaceholder;
#else /* XLAP */
typedef char XlapTimestampPlaceholder;
typedef char XlapTimestampPlaceholder;
#endif
/*
......@@ -112,16 +114,16 @@ typedef struct XlapTimestampTableRow {
#ifdef XLAP
# define XlapTimeStampValue(sck, kind, seqno, id, value) do { \
atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.t = value; \
} while (0)
atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.t = value; \
} while (0)
#else /* XLAP */
# define XlapTimeStampValue(sck, kind, seqno, id, value) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
(void) (value); \
} while (0)
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
(void) (value); \
} while (0)
#endif
/*
......@@ -132,15 +134,15 @@ typedef struct XlapTimestampTableRow {
*/
#ifdef XLAP
# define XlapTimeStampClock(sck, kind, seqno, id) do { \
clock_gettime(CLOCK_MONOTONIC, &atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.t); \
} while (0)
clock_gettime(CLOCK_MONOTONIC, &atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.t); \
} while (0)
#else /* XLAP */
# define XlapTimeStampClock(sck, kind, seqno, id) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
#endif
......@@ -152,15 +154,15 @@ typedef struct XlapTimestampTableRow {
*/
#ifdef XLAP
# define XlapTimeStampCycle(sck, kind, seqno, id) do { \
atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.c = __builtin_ia32_rdtsc(); \
} while (0)
atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire)->rows[(seqno) % TS_ROWS].time[ts_##id].actual.c = __builtin_ia32_rdtsc(); \
} while (0)
#else /* XLAP */
# define XlapTimeStampCycle(sck, kind, seqno, id) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
#endif
......@@ -169,16 +171,16 @@ typedef struct XlapTimestampTableRow {
*/
#ifdef XLAP
# define XlapTimestampTableInstall(sck, kind, tstp) do { \
XlapTimestampTable *__tstp = (tstp); \
memset(__tstp, 0, sizeof(XlapTimestampTable)); \
atomic_store_explicit(&(sck)->tstable[kind], __tstp, memory_order_release); \
} while (0)
XlapTimestampTable *__tstp = (tstp); \
memset(__tstp, 0, sizeof(XlapTimestampTable)); \
atomic_store_explicit(&(sck)->tstable[kind], __tstp, memory_order_release); \
} while (0)
#else /* XLAP */
# define XlapTimestampTableInstall(sck, kind, tstp) do { \
(void) (sck); \
(void) (kind); \
(void) (tstp); \
} while (0)
(void) (sck); \
(void) (kind); \
(void) (tstp); \
} while (0)
#endif
......@@ -186,24 +188,24 @@ typedef struct XlapTimestampTableRow {
* print a timestamp dump header
*/
#ifdef XLAP
extern void XlapTimestampTableDumpHeader(FILE *);
extern void XlapTimestampTableDumpHeader(FILE *);
#else
# define XlapTimestampTableDumpHeader(f) do { \
(void) (f); \
} while (0)
(void) (f); \
} while (0)
#endif
/*
* dump a timestamp table
*/
#ifdef XLAP
extern void XlapTimestampTableDump(FILE *, XlapTimestampPacketKind, XlapTimestampTable *);
extern void XlapTimestampTableDump(FILE *, XlapTimestampPacketKind, XlapTimestampTable *);
#else
# define XlapTimestampTableDump(f, k, t) do { \
(void) (f); \
(void) (k); \
(void) (t); \
} while (0)
(void) (f); \
(void) (k); \
(void) (t); \
} while (0)
#endif
/*
......@@ -211,14 +213,14 @@ typedef struct XlapTimestampTableRow {
*/
#ifdef XLAP
# define XlapTimestampPlaceholderInitialize(ph) do { \
XlapTimestampPlaceholder *__ph = (ph); \
atomic_store_explicit(&__ph->tstable[0], (XlapTimestampTable *) &__ph->rows, memory_order_release); \
memset(&__ph->rows, 0x0, sizeof(XlapTimestampTableRow)); \
} while (0)
XlapTimestampPlaceholder *__ph = (ph); \
atomic_store_explicit(&__ph->tstable[0], (XlapTimestampTable *) &__ph->rows, memory_order_release); \
memset(&__ph->rows, 0x0, sizeof(XlapTimestampTableRow)); \
} while (0)
#else
# define XlapTimestampPlaceholderInitialize(ph) do { \
(void) (ph); \
} while (0)
(void) (ph); \
} while (0)
#endif
/*
......@@ -229,21 +231,21 @@ typedef struct XlapTimestampTableRow {
*/
#ifdef XLAP
# define XlapTimestampPlaceholderUse(sck, kind, seqno, ph) do { \
XlapTimestampPlaceholder *__ph = (ph); \
XlapTimestampTable *__ts = atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire); \
for (unsigned int __t = 0; __t < ts_count; __t++) { \
__ts->rows[seqno % TS_ROWS].time[__t].actual.t.tv_sec += __ph->rows[0].time[__t].actual.t.tv_sec; \
__ts->rows[seqno % TS_ROWS].time[__t].actual.t.tv_nsec += __ph->rows[0].time[__t].actual.t.tv_nsec; \
__ts->rows[seqno % TS_ROWS].time[__t].actual.c += __ph->rows[0].time[__t].actual.c; \
} \
} while (0)
XlapTimestampPlaceholder *__ph = (ph); \
XlapTimestampTable *__ts = atomic_load_explicit(&(sck)->tstable[kind], memory_order_acquire); \
for (unsigned int __t = 0; __t < ts_count; __t++) { \
__ts->rows[seqno % TS_ROWS].time[__t].actual.t.tv_sec += __ph->rows[0].time[__t].actual.t.tv_sec; \
__ts->rows[seqno % TS_ROWS].time[__t].actual.t.tv_nsec += __ph->rows[0].time[__t].actual.t.tv_nsec; \
__ts->rows[seqno % TS_ROWS].time[__t].actual.c += __ph->rows[0].time[__t].actual.c; \
} \
} while (0)
#else
# define XlapTimestampPlaceholderUse(sck, kind, seqno, ph) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ph); \
} while (0)
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ph); \
} while (0)
#endif
#endif // XLAP_H
......@@ -56,6 +56,14 @@ stamps:
Source: sender
Thread: trans_send
Type: cycle
PrrtSendPacketStart:
Source: sender
Thread: trans_send
Type: cycle
PrrtSendPacketEnd:
Source: sender
Thread: trans_send
Type: cycle
LinkTransmitStart:
Source: sender
Thread: trans_send
......@@ -64,7 +72,15 @@ stamps:
Source: sender
Thread: trans_send
Type: time
ChannelTransmit:
Source: sender
Thread: trans_send
Type: none
ChannelReceive:
Source: receiver
Thread: trans_send
Type: none
LinkReceive:
Source: receiver
Thread: trans_recv
......
......@@ -5,7 +5,7 @@ import ruamel.yaml as yaml
def _stamp_name_by_src_and_type(all_stamps, src, kind=None):
if kind is None:
kind = ["time", "cycle"]
kind = ["time", "cycle", "none"]
return [c for c, v in all_stamps.items() if v["Source"] == src and v["Type"] in kind]
def _stamp_name_by_thread_and_type(all_stamps, thread, kind=None):
......@@ -13,7 +13,7 @@ def _stamp_name_by_thread_and_type(all_stamps, thread, kind=None):
kind = ["time", "cycle"]
return [c for c, v in all_stamps.items() if v["Thread"] == thread and v["Type"] in kind]
def _extract_stamps_by_type(all_stamps, src, kind=None):
def _extract_stamps_by_src_and_kind(all_stamps, src, kind=None):
columns = _stamp_name_by_src_and_type(all_stamps, src, kind)
return [x + "_T" for x in columns] + [x + "_C" for x in columns]
......@@ -26,9 +26,9 @@ def _evaluate_file(file_name, stamps, kind, sender=False):
# Drop columns of opposing side.
if sender:
df.drop(_extract_stamps_by_type(stamps, "receiver"), axis=1, inplace=True)
df.drop(_extract_stamps_by_src_and_kind(stamps, "receiver"), axis=1, inplace=True)
else:
df.drop(_extract_stamps_by_type(stamps, "sender"), axis=1, inplace=True)
df.drop(_extract_stamps_by_src_and_kind(stamps, "sender"), axis=1, inplace=True)
# Drop empty rows (as they have probably not been written out).
return df[pd.notnull(df).all(axis=1)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment