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
zzha zzha
OpenXG-RAN
Commits
e88779c4
Commit
e88779c4
authored
8 years ago
by
Xenofon Foukas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for lightweight finegrained task timer
parent
e78075e8
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
7 deletions
+36
-7
openair2/ENB_APP/enb_agent.c
openair2/ENB_APP/enb_agent.c
+23
-7
openair2/ENB_APP/enb_agent_common.c
openair2/ENB_APP/enb_agent_common.c
+9
-0
openair2/ENB_APP/enb_agent_common.h
openair2/ENB_APP/enb_agent_common.h
+4
-0
No files found.
openair2/ENB_APP/enb_agent.c
View file @
e88779c4
...
...
@@ -50,7 +50,7 @@ enb_agent_info_t enb_agent_info;
char
in_ip
[
40
];
static
uint16_t
in_port
;
//
void *send_thread(void *args);
void
*
send_thread
(
void
*
args
);
void
*
receive_thread
(
void
*
args
);
pthread_t
new_thread
(
void
*
(
*
f
)(
void
*
),
void
*
b
);
err_code_t
enb_agent_timeout
(
void
*
args
);
...
...
@@ -100,20 +100,35 @@ void *enb_agent_task(void *args){
return
NULL
;
}
/*
void
*
send_thread
(
void
*
args
)
{
#ifdef TEST_TIMER
msg_context_t
*
d
=
args
;
void
*
data
;
int
size
;
int
priority
;
struct
timeval
t1
,
t2
;
long
long
t
;
struct
timespec
ts
;
unsigned
int
delay
=
250
*
1000
;
while
(
1
)
{
gettimeofday
(
&
t1
,
NULL
);
enb_agent_sleep_until
(
&
ts
,
delay
);
gettimeofday
(
&
t2
,
NULL
);
t
=
((
t2
.
tv_sec
*
1000000
)
+
t2
.
tv_usec
)
-
((
t1
.
tv_sec
*
1000000
)
+
t1
.
tv_usec
);
LOG_I
(
ENB_AGENT
,
"Call to sleep_until(%d) took %lld us
\n
"
,
delay
,
t
);
sleep
(
1
);
}
while (1) {
#endif
/* while (1) {
// need logic for the timer, and
usleep(10);
if (message_put(d->tx_mq, data, size, priority)) goto error;
}
}*/
return
NULL
;
...
...
@@ -121,7 +136,7 @@ error:
printf
(
"receive_thread: there was an error
\n
"
);
return
NULL
;
}
*/
void
*
receive_thread
(
void
*
args
)
{
msg_context_t
*
d
=
args
;
...
...
@@ -293,10 +308,11 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){
enb_agent_create_timer
(
1
,
0
,
ENB_AGENT_DEFAULT
,
mod_id
,
ENB_AGENT_TIMER_TYPE_PERIODIC
,
enb_agent_timeout
,(
void
*
)
&
timer_args
,
&
timer_id
);
#endif
//
new_thread(send_thread, &shared_ctxt);
new_thread
(
send_thread
,
&
shared_ctxt
);
//while (1) pause();
LOG_I
(
ENB_AGENT
,
"client ends
\n
"
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent_common.c
View file @
e88779c4
...
...
@@ -476,6 +476,15 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) {
return
RB_FIND
(
enb_agent_map
,
&
timer_instance
.
enb_agent_head
,
search
);
}
void
enb_agent_sleep_until
(
struct
timespec
*
ts
,
int
delay
)
{
ts
->
tv_nsec
+=
delay
;
if
(
ts
->
tv_nsec
>=
1000
*
1000
*
1000
){
ts
->
tv_nsec
-=
1000
*
1000
*
1000
;
ts
->
tv_sec
++
;
}
clock_nanosleep
(
CLOCK_MONOTONIC
,
TIMER_ABSTIME
,
ts
,
NULL
);
}
/*
int i =0;
RB_FOREACH(e, enb_agent_map, &enb_agent_head) {
...
...
This diff is collapsed.
Click to expand it.
openair2/ENB_APP/enb_agent_common.h
View file @
e88779c4
...
...
@@ -39,6 +39,7 @@
#ifndef ENB_AGENT_COMMON_H_
#define ENB_AGENT_COMMON_H_
#include <time.h>
#include "header.pb-c.h"
#include "progran.pb-c.h"
...
...
@@ -228,6 +229,9 @@ err_code_t enb_agent_process_timeout(long timer_id, void* timer_args);
int
enb_agent_compare_timer
(
struct
enb_agent_timer_element_s
*
a
,
struct
enb_agent_timer_element_s
*
b
);
/*Specify a delay in nanoseconds to timespec and sleep until then*/
void
enb_agent_sleep_until
(
struct
timespec
*
ts
,
int
delay
);
/* RB_PROTOTYPE is for .h files */
RB_PROTOTYPE
(
enb_agent_map
,
enb_agent_timer_element_s
,
entry
,
enb_agent_compare_timer
);
...
...
This diff is collapsed.
Click to expand it.
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