Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Worker.N
openairinterface5G
Commits
e88779c4
Commit
e88779c4
authored
9 years ago
by
Xenofon Foukas
Browse files
Options
Downloads
Patches
Plain Diff
Added support for lightweight finegrained task timer
parent
e78075e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
openair2/ENB_APP/enb_agent.c
+23
-7
23 additions, 7 deletions
openair2/ENB_APP/enb_agent.c
openair2/ENB_APP/enb_agent_common.c
+9
-0
9 additions, 0 deletions
openair2/ENB_APP/enb_agent_common.c
openair2/ENB_APP/enb_agent_common.h
+4
-0
4 additions, 0 deletions
openair2/ENB_APP/enb_agent_common.h
with
36 additions
and
7 deletions
openair2/ENB_APP/enb_agent.c
+
23
−
7
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
;
while (1) {
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
);
}
#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,9 +308,10 @@ 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
+
9
−
0
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
+
4
−
0
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.
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