?? interference_init.cpp
字號:
#define S_FUNCTION_NAME interference_init#include "ttkernel.cpp"// Task generating disturbance network traffic // code functiondouble sender_code(int seg, void *data){ double BWshare = 0.5; if ((double)rand()/(double)RAND_MAX < BWshare) { ttSendMsg(1, 1, NULL, 10); // send 10 bytes to myself (no data) } return FINISHED;}double msgRcvhandler(int seg, void *data){ void *msg; msg = ttGetMsg(1); return FINISHED;}void init(){ ttInitKernel(0, 0, FP); // Sender task ttCreatePeriodicTask("sender", 0.0, 0.001, 1, sender_code); // Initialize network ttCreateInterruptHandler("msgRcv", 1, msgRcvhandler); ttInitNetwork(1, "msgRcv"); // I am node 1}void cleanup() {}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -