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
canghaiwuhen
OpenXG-RAN
Commits
30ffc8d2
Commit
30ffc8d2
authored
May 15, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix and optimizations in view/time.c
not very efficient, to be refined
parent
f49489a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
common/utils/T/tracer/view/time.c
common/utils/T/tracer/view/time.c
+5
-11
No files found.
common/utils/T/tracer/view/time.c
View file @
30ffc8d2
...
@@ -101,6 +101,7 @@ static void *time_thread(void *_this)
...
@@ -101,6 +101,7 @@ static void *time_thread(void *_this)
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
timeline_get_width
(
this
->
g
,
this
->
w
,
&
width
);
timeline_get_width
(
this
->
g
,
this
->
w
,
&
width
);
timeline_clear_silent
(
this
->
g
,
this
->
w
);
/* TODO: optimize/cleanup */
/* TODO: optimize/cleanup */
...
@@ -112,15 +113,6 @@ static void *time_thread(void *_this)
...
@@ -112,15 +113,6 @@ static void *time_thread(void *_this)
struct
timespec
tick_start
,
tick_end
;
struct
timespec
tick_start
,
tick_end
;
tick_start
=
time_add
(
tstart
,
nano_to_time
(
this
->
pixel_length
*
i
));
tick_start
=
time_add
(
tstart
,
nano_to_time
(
this
->
pixel_length
*
i
));
tick_end
=
time_add
(
tick_start
,
nano_to_time
(
this
->
pixel_length
-
1
));
tick_end
=
time_add
(
tick_start
,
nano_to_time
(
this
->
pixel_length
-
1
));
/* if tick is before start, do nothing */
if
(
time_cmp
(
tick_end
,
(
struct
timespec
){
tv_sec
:
this
->
tstart_time
,
tv_nsec
:
0
})
<
0
)
continue
;
/* if tick after end, do nothing */
if
(
time_cmp
(
tick_start
,
time_add
((
struct
timespec
){
tv_sec
:
this
->
tstart_time
,
tv_nsec
:
0
},
nano_to_time
(
this
->
pixel_length
*
width
)))
>=
0
)
continue
;
/* look for a nano between tick_start and tick_end */
/* look for a nano between tick_start and tick_end */
/* TODO: optimize */
/* TODO: optimize */
for
(
t
=
0
;
t
<
this
->
tsize
;
t
++
)
{
for
(
t
=
0
;
t
<
this
->
tsize
;
t
++
)
{
...
@@ -145,10 +137,12 @@ static void *time_thread(void *_this)
...
@@ -145,10 +137,12 @@ static void *time_thread(void *_this)
continue
;
continue
;
gotit:
gotit:
/* TODO: only one call */
/* TODO: only one call */
timeline_add_points
(
this
->
g
,
this
->
w
,
p
->
line
,
p
->
color
,
&
i
,
1
);
timeline_add_points
_silent
(
this
->
g
,
this
->
w
,
p
->
line
,
p
->
color
,
&
i
,
1
);
}
}
}
}
widget_dirty
(
this
->
g
,
this
->
w
);
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
sleepms
(
1000
/
this
->
refresh_rate
);
sleepms
(
1000
/
this
->
refresh_rate
);
}
}
...
@@ -212,7 +206,7 @@ static void append(view *_this, struct timespec t)
...
@@ -212,7 +206,7 @@ static void append(view *_this, struct timespec t)
/* tick out of current window? if yes, move window */
/* tick out of current window? if yes, move window */
/* if too far, free all */
/* if too far, free all */
if
(
end_time
-
t
.
tv_sec
>
time
->
tsize
)
{
if
(
t
.
tv_sec
>
end_time
&&
t
.
tv_sec
-
end_time
>
time
->
tsize
)
{
for
(
l
=
0
;
l
<
time
->
tsize
;
l
++
)
for
(
l
=
0
;
l
<
time
->
tsize
;
l
++
)
for
(
i
=
0
;
i
<
time
->
subcount
;
i
++
)
{
for
(
i
=
0
;
i
<
time
->
subcount
;
i
++
)
{
free
(
time
->
t
[
l
].
p
[
i
].
nano
);
free
(
time
->
t
[
l
].
p
[
i
].
nano
);
...
...
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