Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
U
udpdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ywj
udpdk
Commits
949ee92c
Commit
949ee92c
authored
Nov 13, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update pktgen
parent
f03fc595
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
apps/pktgen/README
apps/pktgen/README
+1
-1
apps/pktgen/main.c
apps/pktgen/main.c
+12
-1
No files found.
apps/pktgen/README
View file @
949ee92c
Sender:
sudo ./pktgen -c ../../config.ini -f send -l 100
sudo ./pktgen -c ../../config.ini -f send -l 100
-r 10000
Receiver:
sudo ./pktgen -c ../../config.ini -f recv
...
...
apps/pktgen/main.c
View file @
949ee92c
...
...
@@ -33,6 +33,8 @@
typedef
struct
stats_t
{
uint64_t
bytes_sent
;
uint64_t
bytes_recv
;
uint64_t
bytes_sent_prev
;
uint64_t
bytes_recv_prev
;
}
stats_t
;
const
char
mydata
[
2048
]
=
{
...
...
@@ -259,15 +261,24 @@ static void reset_stats(stats_t *stats)
{
stats
->
bytes_sent
=
0
;
stats
->
bytes_recv
=
0
;
stats
->
bytes_sent_prev
=
0
;
stats
->
bytes_recv_prev
=
0
;
}
static
void
*
stats_routine
(
void
*
arg
)
{
stats_t
*
stats
=
(
stats_t
*
)
arg
;
uint64_t
tx_bps
=
0
,
rx_bps
=
0
;
pthread_setcanceltype
(
PTHREAD_CANCEL_ASYNCHRONOUS
,
NULL
);
while
(
1
)
{
printf
(
"Sent: %ld bps | Recv: %ld bps
\n
"
,
stats
->
bytes_sent
,
stats
->
bytes_recv
);
tx_bps
=
stats
->
bytes_sent
-
stats
->
bytes_sent_prev
;
rx_bps
=
stats
->
bytes_recv
-
stats
->
bytes_recv_prev
;
printf
(
"Sent: %ld bytes %ld bps | Recv: %ld bytes %ld bps
\n
"
,
stats
->
bytes_sent
,
tx_bps
,
stats
->
bytes_recv
,
rx_bps
);
stats
->
bytes_sent_prev
=
stats
->
bytes_sent
;
stats
->
bytes_recv_prev
=
stats
->
bytes_recv
;
sleep
(
1
);
}
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment