Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs452Trainee
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Feng
cs452Trainee
Commits
f3f262af
Commit
f3f262af
authored
6 years ago
by
antnh6@gmail.com
Browse files
Options
Downloads
Patches
Plain Diff
fixed Perf file
parent
2598b051
Branches
kernel2-Perf
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/k2PerfTest.c
+31
-20
31 additions, 20 deletions
src/k2PerfTest.c
with
31 additions
and
20 deletions
src/k2PerfTest.c
+
31
−
20
View file @
f3f262af
...
...
@@ -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
;
s
um
+=
e
ndTime
-
s
tartTime
;
S
um
+=
(
E
ndTime
-
S
tartTime
)
;
}
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
)
);
s
um
+=
(
EndTime
-
StartTime
);
Reply
(
SenderTID
,
(
char
*
)
ReplyMsg
,
Res
);
S
um
+=
(
EndTime
-
StartTime
);
}
s
um
/
=
100
;
bwpritnf
(
COM2
,
"Time: %d
\n\r
"
,
sum
);
Average
=
S
um
/
100
;
bwpritnf
(
COM2
,
"Time: %d
\n\r
"
,
Average
);
Exit
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment