Commit ba937310 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Add xlap timestamping code and evaluation suite.

parent ba753077
build/
dist/
xlap.egg-info/
.ipynb_checkpoints/
\ No newline at end of file
# X-Lap: A Systems Approach for Cross-Layer Profiling and Latency Analysis for Cyber-Physical Networks
## How to install X-Lap?
Enter the project directory and type `python setup.py install` to install `xlap` on your system.
## How to use X-lap?
### Step 0: Define your relevant timestamps across a packet trace.
Define time- and cyclestamps:
* Where data enters the sender app.
* Where data leaves the sender app.
* Where data enters the receiver app.
* Where data leaves the receiver app.
* Define additional cyclestamps wherever appropriate.
* Define interesting durations inside xlap.yml.
### Step 1: Instrument your code and generate traces
* Define a Sender and Receiver Application (send arbitrary data around).
* Initialize the xlap facility.
* Add stamping code where-ever appropriate.
* There are different mechanisms for adding timestamps.
### Step 2: Use the provided xlap analysis tools
* Write your `xlap.yml` file as follows:
```yml
data_files:
sender: sender.csv
receiver: receiver.csv
cycle_reference:
sender: StampA
receiver: SampB
time_reference:
sender: StampC
receiver: StampE
stamps:
StampA:
Source: receiver
Type: time
StampB:
Source: receiver
Type: time
StampC:
Source: receiver
Type: time
StampD:
Source: receiver
Type: cycle
StampE:
Source: receiver
Type: time
durations:
DurationA:
Start: StampA
Stop: StampB
Source: sender
DurationB:
Start: StampC
Stop: StampD
Source: receiver
packet_types:
Data: 0
Ack: 1
```
* You can run a jitter analysis via `xlap jitter`. The parameter `-e` exports the diagrams as `pdf`.
* The best way to interact with `xlap` is through a [Jupyter Python 3 Notebook](http://jupyter.org/). An example can be found in `notebook.ipynb`.
* `xlap.analyse.trace.traces()` can be used to investigate individual packet traces.
## Conventions
* Suffixes (indicate type):
* `_T`: Timestamp (us precision)
* `_C`: Clockstamp
* `_D`: Duration (us precision)
* Reserved Names (including suffixes as mentioned before):
* `Channel`
* `Sender`
* `SenderCycle`
* `Receiver`
* `ReceiverCycle`
* `EndToEnd`
* Note that expressions with other suffixes such as `SenderQueueing_T` would be allowed.
This diff is collapsed.
/*
* pp.h
*
* This file contains some useful preprocessor macros.
*
* Warning: This file is auto-generated. Do not edit.
*/
#ifndef __PP_H__
#define __PP_H__ 1
/*
* PP__cmn_* macros
*
* PP common macros
*/
#define PP__cmn_id(...) __VA_ARGS__
#define PP__cmn_call(m,...) m(__VA_ARGS__)
/*
* PP__arg_* macros
*
* PP macros that operate on argument lists.
*/
#define PP_arg_count(...) PP__arg_cnt(__VA_ARGS__)
#define PP__arg_cnt(...) PP__arg_cnt_2(__VA_ARGS__,128,127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
#define PP__arg_cnt_2(_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9,_a10,_a11,_a12,_a13,_a14,_a15,_a16,_a17,_a18,_a19,_a20,_a21,_a22,_a23,_a24,_a25,_a26,_a27,_a28,_a29,_a30,_a31,_a32,_a33,_a34,_a35,_a36,_a37,_a38,_a39,_a40,_a41,_a42,_a43,_a44,_a45,_a46,_a47,_a48,_a49,_a50,_a51,_a52,_a53,_a54,_a55,_a56,_a57,_a58,_a59,_a60,_a61,_a62,_a63,_a64,_a65,_a66,_a67,_a68,_a69,_a70,_a71,_a72,_a73,_a74,_a75,_a76,_a77,_a78,_a79,_a80,_a81,_a82,_a83,_a84,_a85,_a86,_a87,_a88,_a89,_a90,_a91,_a92,_a93,_a94,_a95,_a96,_a97,_a98,_a99,_a100,_a101,_a102,_a103,_a104,_a105,_a106,_a107,_a108,_a109,_a110,_a111,_a112,_a113,_a114,_a115,_a116,_a117,_a118,_a119,_a120,_a121,_a122,_a123,_a124,_a125,_a126,_a127,_a128,_x,...) _x
/*
* argument list map-reduce macros
*/
#define PP__mapreduce_1(reduce,eol,map,a) eol(map(a))
#define PP__mapreduce_2(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_1(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_3(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_2(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_4(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_3(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_5(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_4(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_6(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_5(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_7(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_6(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_8(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_7(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_9(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_8(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_10(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_9(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_11(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_10(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_12(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_11(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_13(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_12(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_14(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_13(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_15(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_14(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_16(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_15(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_17(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_16(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_18(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_17(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_19(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_18(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_20(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_19(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_21(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_20(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_22(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_21(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_23(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_22(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_24(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_23(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_25(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_24(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_26(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_25(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_27(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_26(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_28(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_27(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_29(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_28(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_30(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_29(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_31(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_30(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_32(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_31(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_33(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_32(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_34(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_33(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_35(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_34(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_36(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_35(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_37(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_36(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_38(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_37(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_39(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_38(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_40(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_39(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_41(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_40(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_42(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_41(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_43(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_42(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_44(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_43(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_45(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_44(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_46(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_45(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_47(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_46(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_48(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_47(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_49(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_48(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_50(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_49(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_51(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_50(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_52(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_51(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_53(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_52(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_54(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_53(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_55(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_54(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_56(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_55(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_57(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_56(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_58(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_57(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_59(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_58(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_60(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_59(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_61(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_60(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_62(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_61(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_63(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_62(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_64(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_63(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_65(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_64(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_66(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_65(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_67(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_66(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_68(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_67(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_69(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_68(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_70(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_69(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_71(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_70(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_72(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_71(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_73(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_72(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_74(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_73(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_75(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_74(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_76(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_75(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_77(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_76(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_78(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_77(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_79(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_78(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_80(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_79(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_81(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_80(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_82(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_81(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_83(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_82(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_84(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_83(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_85(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_84(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_86(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_85(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_87(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_86(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_88(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_87(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_89(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_88(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_90(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_89(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_91(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_90(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_92(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_91(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_93(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_92(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_94(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_93(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_95(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_94(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_96(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_95(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_97(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_96(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_98(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_97(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_99(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_98(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_100(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_99(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_101(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_100(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_102(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_101(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_103(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_102(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_104(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_103(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_105(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_104(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_106(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_105(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_107(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_106(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_108(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_107(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_109(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_108(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_110(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_109(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_111(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_110(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_112(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_111(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_113(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_112(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_114(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_113(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_115(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_114(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_116(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_115(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_117(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_116(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_118(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_117(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_119(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_118(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_120(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_119(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_121(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_120(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_122(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_121(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_123(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_122(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_124(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_123(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_125(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_124(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_126(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_125(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_127(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_126(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce_128(reduce,eol,map,head,...) reduce(map(head),PP__mapreduce_127(reduce,eol,map,__VA_ARGS__))
#define PP__mapreduce(reduce,eol,map,...) PP__mapreduce__i(PP__arg_cnt(__VA_ARGS__),reduce,eol,map,__VA_ARGS__)
#define PP__mapreduce__i(n,reduce,eol,map,...) PP__mapreduce__ii(n,reduce,eol,map,__VA_ARGS__)
#define PP__mapreduce__ii(n,reduce,eol,map,...) PP__mapreduce_##n(reduce,eol,map,__VA_ARGS__)
/*
* foreach loop
*/
#define PP_foreach(join,map,...) PP__mapreduce(join,PP__cmn_id,map,__VA_ARGS__)
/*
* common join and map operations
*/
#define PP_join_space(a,b) a b
#define PP_join_comma(a,b) a,b
#define PP_join_plus(a,b) a+b
#define PP_join_minus(a,b) a-b
#define PP_join_mul(a,b) a*b
#define PP_join_or(a,b) a|b
#define PP_join_and(a,b) a&b
#define PP_join_lor(a,b) a||b
#define PP_join_land(a,b) a&&b
#define PP_join_xor(a,b) a^b
#define PP_join_glue(a,b) PP__join_glue(a,b)
#define PP__join_glue(a,b) a##b
#define PP_id(...) __VA_ARGS__
#define PP_stringify(x) PP__stringify(x)
#define PP__stringify(x) #x
#endif /* __PP_H__ */
numpy==1.12.1
scipy==0.19.0
pandas==0.20.1
matplotlib==2.0.1
sklearn==0.0
ruamel.yaml==3.12
from setuptools import setup, find_packages
setup(
name="xlap",
version="0.0.2",
packages=find_packages(),
entry_points={
"console_scripts": [
"xlap=xlap.command_line:main"
]
}
)
python setup.py install
#define XLAP
#include "xlap.h"
#include <stdatomic.h>
void XlapTimestampTableDumpHeader(FILE *out)
{
fprintf(out, "SeqNo,Kind" );
# define OUT(id) fprintf(out, ",%s_T,%s_C", #id, #id);
PP_foreach(PP_join_space, OUT, TIMESTAMP_ID_LIST)
# undef OUT
fprintf(out, "\n");
}
static inline unsigned long long timestampByTime(struct timespec *ts)
{
// convert timespec to microseconds
unsigned long long x = ts->tv_sec;
x *= 1000000ULL;
x += ts->tv_nsec / 1000;
return x;
}
void XlapTimestampTableDump(FILE *out, XlapTimestampPacketKind kind, XlapTimestampTable *table)
{
# define OUT(id) fprintf(out, ",%llu,%llu", timestampByTime(&table->rows[row].time[ts_##id].actual.t), (unsigned long long) table->rows[row].time[ts_##id].actual.c);
for (unsigned int row = 0; row < TS_ROWS; row++) {
fprintf(out, "%u,%u", row, (unsigned) kind);
PP_foreach(PP_join_space, OUT, TIMESTAMP_ID_LIST)
fprintf(out, "\n");
}
# undef OUT
}
#ifndef XLAP_H
#define XLAP_H
#include <stdio.h>
#include <stdint.h>
#include <time.h>
/*
* Each timestamp contains both a cycle value and a time value, but some values
* might remain zero
*/
typedef union XlapTimestamp {
struct XlapActualTimestamp {
uint64_t c;
struct timespec t;
} actual;
char _cacheline[64];
} XlapTimestamp;
#include "pp.h"
/*
* Comma-separated list of timestamp IDs
*/
#define TIMESTAMP_ID_LIST \
PrrtSendStart, \
PrrtSendEnd, \
PrrtSubmitPackage, \
PrrtEncodeStart, \
PrrtEncodeEnd, \
PrrtTransmitStart, \
PrrtTransmitEnd, \
LinkTransmitStart, \
LinkTransmitEnd, \
LinkReceive, \
DecodeStart, \
DecodeEnd, \
HandlePacketStart, \
HandlePacketEnd, \
CopyOutputStart, \
CopyOutputEnd, \
SendFeedbackStart, \
SendFeedbackEnd, \
PrrtReturnPackage, \
PrrtReceivePackage, \
PrrtDeliver \
#define TIMESSTAMP_ID_TO_NAME(id) ts_##id
/*
* enum containing all timestamp IDs
*/
typedef enum XlapTimestampId {
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,
} XlapTimestampPacketKind;
/*
* Table that stores timestamps for each timestamp ID
*/
typedef struct XlapTimestampTableRow {
XlapTimestamp time[ts_count];
} XlapTimestampTableRow;
/*
* by default, store timestamps for 128 packages
*/
#ifndef TS_ROWS
#define TS_ROWS (1u<<12)
#endif
/*
* Table that stores timestamp table rows
*/
#ifdef XLAP
typedef struct XlapTimestampTable {
XlapTimestampTableRow rows[TS_ROWS];
} XlapTimestampTable;
#else /* XLAP */
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;
#else /* XLAP */
typedef char XlapTimestampPlaceholder;
#endif
/*
* update the clock value of a timestamp
*
* This macro will cause a SIGSEGV if the application does not install a
* timestamp table to the socket.
*/
#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)
#else /* XLAP */
# define XlapTimeStampClock(sck, kind, seqno, id) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
#endif
/*
* update the cycle value of a timestamp
*
* This macro will cause a SIGSEGV if the application does not install a
* timestamp table to the socket.
*/
#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)
#else /* XLAP */
# define XlapTimeStampCycle(sck, kind, seqno, id) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ts_##id); \
} while (0)
#endif
/*
* install a time stamp table to a socket
*/
#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)
#else /* XLAP */
# define XlapTimestampTableInstall(sck, kind, tstp) do { \
(void) (sck); \
(void) (kind); \
(void) (tstp); \
} while (0)
#endif
/*
* print a timestamp dump header
*/
#ifdef XLAP
extern void XlapTimestampTableDumpHeader(FILE *);
#else
# define XlapTimestampTableDumpHeader(f) do { \
(void) (f); \
} while (0)
#endif
/*
* dump a timestamp table
*/
#ifdef XLAP
extern void XlapTimestampTableDump(FILE *, XlapTimestampPacketKind, XlapTimestampTable *);
#else
# define XlapTimestampTableDump(f, k, t) do { \
(void) (f); \
(void) (k); \
(void) (t); \
} while (0)
#endif
/*
* intialize a timestamp table placeholder
*/
#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)
#else
# define XlapTimestampPlaceholderInitialize(ph) do { \
(void) (ph); \
} while (0)
#endif
/*
* copy a timestamp table placeholder into an actual timestamp table
*
* Since every timestamp is taken at most once, either the timestamptable or
* the placeholder value must be zero (for each timestamp).
*/
#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)
#else
# define XlapTimestampPlaceholderUse(sck, kind, seqno, ph) do { \
(void) (sck); \
(void) (kind); \
(void) (seqno); \
(void) (ph); \
} while (0)
#endif
#endif // XLAP_H
data_files:
sender: "rtn2017/results/on/2017_03_28_09_33_00_Sender.csv"
receiver: "rtn2017/results/on/2017_03_28_09_33_00_Receiver.csv"
cycle_reference:
sender:
Start: PrrtSendStart
Stop: LinkTransmitEnd
receiver:
Start: PrrtReceivePackage
Stop: PrrtDeliver
time_reference:
sender:
Start: PrrtSendStart
Stop: LinkTransmitEnd
receiver:
Start: LinkReceive
Stop: PrrtDeliver
stamps:
PrrtSendStart:
Source: sender
Type: time
PrrtSendEnd:
Source: sender
Type: time
PrrtSubmitPackage:
Source: sender
Type: cycle
PrrtEncodeStart:
Source: sender
Type: cycle
PrrtEncodeEnd:
Source: sender
Type: cycle
PrrtTransmitStart:
Source: sender
Type: cycle
PrrtTransmitStart:
Source: sender
Type: cycle
PrrtTransmitEnd:
Source: sender
Type: cycle
LinkTransmitStart:
Source: sender
Type: cycle
LinkTransmitEnd:
Source: sender
Type: time
LinkReceive:
Source: receiver
Type: time
PrrtDeliver:
Source: receiver
Type: time
SendFeedbackStart:
Source: receiver
Type: cycle
SendFeedbackEnd:
Source: receiver
Type: cycle
DecodeStart:
Source: receiver
Type: cycle
DecodeEnd:
Source: receiver
Type: cycle
HandlePacketStart: