Skip to content
Snippets Groups Projects
Commit f3f262af authored by antnh6@gmail.com's avatar antnh6@gmail.com
Browse files

fixed Perf file

parent 2598b051
Branches kernel2-Perf
No related tags found
No related merge requests found
......@@ -3,10 +3,13 @@
#include <syscall.h>
#include "nameserver.h"
void Sender() {
int ReceiverTID, Result, i, startTime, endTime;
int sum = 0;;
int SendMsg, ReplyMsg;
int Sender() {
int ReceiverTID, Result, i, StartTime, EndTime, Res;
int Sum = 0, Average;
char* SendMsg = "water water water loo loo loo, water water water loo loo loo, water water water loo loo loo cs452 cs452"
char ReplyMsg[32]; // 4 bytes
char ReplyMsg[256] // 64 bytes
Clock* c;
ClockInit(c);
......@@ -15,41 +18,49 @@ void Sender() {
for (i = 0; i < 100; ++i) {
ClockUpdate(c);
startTime = c->ClockCount;
Send(ReceiverTID, (void*)SendMsg, sizeof(SendMsg), (void*)ReplyMsg, sizeof(ReplyMsg));
Res = Send(ReceiverTID, (char*)SendMsg, 32, ReplyMsg, 32);
if (Res != 32) {
bwprintf(COM2, "Send has Errors");
return Res;
}
ClockUpdate(c);
endTime = c->ClockCount;
sum += endTime - startTime;
Sum += (EndTime - StartTime);
}
sum /= 100;
bwprintf(COM2, "Time: \n\r", sum);
Average = Sum/100;
bwprintf(COM2, "Time: \n\r", Average);
Exit();
}
void Receiver() {
int SenderTID, Result, i, StartTime, EndTime;
int sum = 0;
int ReceiveMsg, ReplyMsg; // 4 bytes
int Receiver() {
int SenderTID, i, StartTime, EndTime, Res;
int Sum = 0, Average;
char ReceiveMsg[32];
char ReplyMsg[32]; // 4 bytes
Clock* c;
ClockInit(c);
Result = RegisterAS("Rcvr");
Receive(&SenderTID, (void*)ReceiveMsg, sizeof(ReceiveMsg));
Res = RegisterAS("Rcvr");
Reply(SenderTID, ReplyMsg, sizeof(ReplyMsg));
x
for (i = 0; i < 100; i++) {
ClockUpdate(c);
startTime = c->ClockCount;
Receive(&senderTid, ReceiveMsg, sizeof(ReceiveMsg));
Res = Receive(&SenderTID, (char*)ReceiveMsg, 32);
if (Res < 0) {
bwprintf(COM2, "Receive has Errors.");
return Res;
}
ClockUpdate(c);
endTime = c->ClockCount;
Reply(SenderTID, ReplyMsg, sizeof(ReplyMsg));
sum += (EndTime-StartTime);
Reply(SenderTID, (char*)ReplyMsg, Res);
Sum += (EndTime-StartTime);
}
sum /= 100;
bwpritnf(COM2, "Time: %d\n\r",sum );
Average = Sum / 100;
bwpritnf(COM2, "Time: %d\n\r", Average);
Exit();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment