Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
711e3cac
Commit
711e3cac
authored
Jan 30, 2013
by
Danilo Sabato
Committed by
Alessandro Rubini
Feb 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch-bare-x86-64: timer precision increased
parent
158c7cd9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
bare-linux.h
arch-bare-x86-64/bare-linux.h
+2
-0
bare-timer.c
arch-bare-x86-64/bare-timer.c
+17
-10
syscalls.c
arch-bare-x86-64/syscalls.c
+5
-0
No files found.
arch-bare-x86-64/bare-linux.h
View file @
711e3cac
...
...
@@ -36,6 +36,7 @@ extern int sys_shutdown(int fd, int flags);
extern
int
sys_gettimeofday
(
void
*
tv
,
void
*
z
);
extern
int
sys_settimeofday
(
void
*
tv
,
void
*
z
);
extern
int
sys_adjtimex
(
void
*
tv
);
extern
int
sys_clock_gettime
(
int
clock
,
void
*
t
);
extern
int
bare_errno
;
...
...
@@ -81,6 +82,7 @@ struct bare_ethhdr {
struct
bare_timeval
{
unsigned
long
tv_sec
;
unsigned
long
tv_usec
;
unsigned
long
tv_nsec
;
};
#ifndef NULL
...
...
arch-bare-x86-64/bare-timer.c
View file @
711e3cac
...
...
@@ -15,16 +15,19 @@ int bare_timer_init(struct pp_instance *ppi)
return
0
;
}
int
bare_timer_start
(
uint32_t
interval
,
struct
pp_timer
*
tm
)
int
bare_timer_start
(
uint32_t
interval
_ms
,
struct
pp_timer
*
tm
)
{
tm
->
start
=
(
uint32_t
)
sys_time
(
0
);
tm
->
interval
=
interval
;
struct
bare_timeval
now
;
sys_clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
tm
->
start
=
((
uint64_t
)(
now
.
tv_sec
))
*
1000
+
(
now
.
tv_nsec
/
1000000
);
tm
->
interval_ms
=
interval_ms
;
return
0
;
}
int
bare_timer_stop
(
struct
pp_timer
*
tm
)
{
tm
->
interval
=
0
;
tm
->
interval
_ms
=
0
;
tm
->
start
=
0
;
return
0
;
...
...
@@ -32,17 +35,20 @@ int bare_timer_stop(struct pp_timer *tm)
int
bare_timer_expired
(
struct
pp_timer
*
tm
)
{
uint32_t
now
;
struct
bare_timeval
now
;
uint64_t
now_ms
;
if
(
tm
->
start
==
0
)
{
PP_PRINTF
(
"%p Warning: bare_timer_expired: timer not started
\n
"
,
tm
);
return
0
;
}
now
=
(
uint32_t
)
sys_time
(
0
);
sys_clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
now_ms
=
((
uint64_t
)(
now
.
tv_sec
))
*
1000
+
(
now
.
tv_nsec
/
1000000
);
if
(
tm
->
start
+
tm
->
interval
<=
(
uint32_t
)
now
)
{
tm
->
start
=
(
uint32_t
)
now
;
if
(
now_ms
>
tm
->
start
+
tm
->
interval_ms
)
{
tm
->
start
=
now_ms
;
return
1
;
}
...
...
@@ -51,17 +57,18 @@ int bare_timer_expired(struct pp_timer *tm)
void
bare_timer_adjust_all
(
struct
pp_instance
*
ppi
,
int32_t
diff
)
{
int
i
;
/*
int i;
for (i = 0; i < PP_TIMER_ARRAY_SIZE; i++) {
ppi->timers[i]->start += diff;
}
*/
}
int
pp_timer_init
(
struct
pp_instance
*
ppi
)
__attribute__
((
alias
(
"bare_timer_init"
)));
int
pp_timer_start
(
uint32_t
interval
,
struct
pp_timer
*
tm
)
int
pp_timer_start
(
uint32_t
interval
_ms
,
struct
pp_timer
*
tm
)
__attribute__
((
alias
(
"bare_timer_start"
)));
int
pp_timer_stop
(
struct
pp_timer
*
tm
)
...
...
arch-bare-x86-64/syscalls.c
View file @
711e3cac
...
...
@@ -128,3 +128,8 @@ int sys_adjtimex(void *tv)
return
syscall
(
__NR_adjtimex
,
(
uint64_t
)
tv
,
0
,
0
,
0
,
0
,
0
);
}
int
sys_clock_gettime
(
int
clock
,
void
*
t
)
{
return
syscall
(
__NR_clock_gettime
,
(
uint64_t
)
clock
,
(
uint64_t
)
t
,
0
,
0
,
0
,
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