Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
wangjie
OpenXG-RAN
Commits
f4c939eb
Commit
f4c939eb
authored
May 22, 2021
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nr pdcp: add a small benchmarking program
To use: cd openair2/LAYER2/nr_pdcp/bench make ./bench
parent
b9e11480
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
0 deletions
+137
-0
openair2/LAYER2/nr_pdcp/bench/LOG/log.h
openair2/LAYER2/nr_pdcp/bench/LOG/log.h
+10
-0
openair2/LAYER2/nr_pdcp/bench/Makefile
openair2/LAYER2/nr_pdcp/bench/Makefile
+17
-0
openair2/LAYER2/nr_pdcp/bench/bench.c
openair2/LAYER2/nr_pdcp/bench/bench.c
+110
-0
No files found.
openair2/LAYER2/nr_pdcp/bench/LOG/log.h
0 → 100644
View file @
f4c939eb
#ifndef _NR_PDCP_BENCH_LOG_H_
#define _NR_PDCP_BENCH_LOG_H_
#include <stdio.h>
#define LOG_E(x, ...) printf(__VA_ARGS__)
#define LOG_D(x, ...) printf(__VA_ARGS__)
#define LOG_W(x, ...) printf(__VA_ARGS__)
#endif
/* _NR_PDCP_BENCH_LOG_H_ */
openair2/LAYER2/nr_pdcp/bench/Makefile
0 → 100644
View file @
f4c939eb
CC
=
gcc
CFLAGS
=
-Wall
-g
-I
.
OBJS
=
bench.o nr_pdcp_entity.o nr_pdcp_integrity_nia2.o nr_pdcp_security_nea2.o
\
nr_pdcp_sdu.o
bench
:
$(OBJS)
$(CC)
$(CFLAGS)
-o
$@
$(OBJS)
-lcrypto
-lnettle
%.o
:
../%.c
$(CC)
$(CFLAGS)
-c
-o
$@
$<
%.o
:
%.c
$(CC)
$(CFLAGS)
-c
-o
$@
$<
clean
:
rm
-f
bench
$(OBJS)
openair2/LAYER2/nr_pdcp/bench/bench.c
0 → 100644
View file @
f4c939eb
#include "../nr_pdcp_entity.h"
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <time.h>
void
deliver_sdu_ue
(
void
*
deliver_sdu_data
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
)
{
int
*
count
=
deliver_sdu_data
;
(
*
count
)
++
;
}
void
deliver_pdu_ue
(
void
*
deliver_pdu_data
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
)
{
printf
(
"deliver_pdu_ue %d id %d
\n
"
,
size
,
sdu_id
);
}
void
deliver_sdu_gnb
(
void
*
deliver_sdu_data
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
)
{
printf
(
"deliver_sdu_gnb %d
\n
"
,
size
);
}
void
deliver_pdu_gnb
(
void
*
deliver_pdu_data
,
nr_pdcp_entity_t
*
entity
,
char
*
buf
,
int
size
,
int
sdu_id
)
{
nr_pdcp_entity_t
*
ue
=
deliver_pdu_data
;
ue
->
recv_pdu
(
ue
,
buf
,
size
);
}
uint64_t
get_time
(
void
)
{
struct
timespec
t
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
t
)
!=
0
)
{
printf
(
"error: clock_gettime failed
\n
"
);
return
0
;
}
return
(
uint64_t
)
t
.
tv_sec
*
(
uint64_t
)
1000000
+
(
uint64_t
)
t
.
tv_nsec
/
1000
;
}
void
run_test
(
int
bytes
,
nr_pdcp_entity_t
*
gnb
,
char
*
sdu
,
int
N
,
int
*
count
)
{
int
i
;
uint64_t
start_time
;
uint64_t
stop_time
;
start_time
=
get_time
();
*
count
=
0
;
for
(
i
=
0
;
i
<
N
;
i
++
)
gnb
->
recv_sdu
(
gnb
,
sdu
,
bytes
,
i
);
if
(
*
count
!=
N
)
printf
(
"error, only %d SDUs successfully transmitted instead of %d
\n
"
,
*
count
,
N
);
stop_time
=
get_time
();
printf
(
"%d bytes: %"
PRIu64
" microseconds for %d loops
\n
"
,
bytes
,
stop_time
-
start_time
,
N
);
}
int
main
(
void
)
{
char
sdu
[
9000
];
int
i
;
int
N
=
100000
;
/* loop count for benchmarking */
int
count
;
unsigned
char
ciphering_key
[
16
]
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
};
unsigned
char
integrity_key
[
16
]
=
{
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
0x18
,
0x19
,
0x20
,
0x21
,
0x22
,
0x23
,
0x24
,
0x25
,
0x26
};
nr_pdcp_entity_t
*
ue
;
nr_pdcp_entity_t
*
gnb
;
ue
=
new_nr_pdcp_entity
(
NR_PDCP_DRB_AM
,
0
/* is_gnb */
,
1
,
1
,
0
,
0
,
0
,
deliver_sdu_ue
,
&
count
,
deliver_pdu_ue
,
NULL
,
18
,
/* sn size */
-
1
,
/* t-reordering */
-
1
,
/* discard timer */
2
,
/* ciphering algorithm, 2 = NEA2 */
2
,
/* integrity algorithm, 2 = NIA2 */
ciphering_key
,
integrity_key
);
gnb
=
new_nr_pdcp_entity
(
NR_PDCP_DRB_AM
,
1
/* is_gnb */
,
1
,
1
,
0
,
0
,
0
,
deliver_sdu_gnb
,
NULL
,
deliver_pdu_gnb
,
ue
,
18
,
/* sn size */
-
1
,
/* t-reordering */
-
1
,
/* discard timer */
2
,
/* ciphering algorithm, 2 = NEA2 */
2
,
/* integrity algorithm, 2 = NIA2 */
ciphering_key
,
integrity_key
);
for
(
i
=
0
;
i
<
9000
;
i
++
)
sdu
[
i
]
=
i
&
255
;
run_test
(
10
,
gnb
,
sdu
,
N
,
&
count
);
run_test
(
100
,
gnb
,
sdu
,
N
,
&
count
);
run_test
(
1000
,
gnb
,
sdu
,
N
,
&
count
);
run_test
(
9000
,
gnb
,
sdu
,
N
,
&
count
);
return
0
;
}
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