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
Michael Black
OpenXG-RAN
Commits
f8ae07d3
Commit
f8ae07d3
authored
May 17, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfixes in view/time.c
parent
2e7ab60d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
common/utils/T/tracer/view/time.c
common/utils/T/tracer/view/time.c
+22
-4
No files found.
common/utils/T/tracer/view/time.c
View file @
f8ae07d3
...
...
@@ -97,6 +97,7 @@ static void *time_thread(void *_this)
struct
timespec
tstart
;
struct
timespec
tnext
;
struct
plot
*
p
;
int64_t
pixel_length
;
while
(
1
)
{
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
...
...
@@ -106,14 +107,17 @@ static void *time_thread(void *_this)
/* TODO: optimize/cleanup */
/* use rounded pixel_length */
pixel_length
=
this
->
pixel_length
;
tnext
=
time_add
(
this
->
latest_time
,(
struct
timespec
){
tv_sec
:
0
,
tv_nsec
:
1
});
tstart
=
time_sub
(
tnext
,
nano_to_time
(
this
->
pixel_length
*
width
));
tstart
=
time_sub
(
tnext
,
nano_to_time
(
pixel_length
*
width
));
for
(
l
=
0
;
l
<
this
->
subcount
;
l
++
)
{
for
(
i
=
0
;
i
<
width
;
i
++
)
{
struct
timespec
tick_start
,
tick_end
;
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_start
=
time_add
(
tstart
,
nano_to_time
(
pixel_length
*
i
));
tick_end
=
time_add
(
tick_start
,
nano_to_time
(
pixel_length
-
1
));
/* look for a nano between tick_start and tick_end */
/* TODO: optimize */
for
(
t
=
0
;
t
<
this
->
tsize
;
t
++
)
{
...
...
@@ -131,7 +135,7 @@ static void *time_thread(void *_this)
struct
timespec
nano
=
(
struct
timespec
){
tv_sec
:
current_second
,
tv_nsec
:
p
->
nano
[
n
]};
if
(
time_cmp
(
tick_start
,
nano
)
<=
0
&&
time_cmp
(
nano
,
tick_end
)
<
0
)
time_cmp
(
nano
,
tick_end
)
<
=
0
)
goto
gotit
;
}
}
...
...
@@ -157,11 +161,15 @@ static void scroll(void *private, gui *g,
struct
time
*
this
=
private
;
double
mul
=
1
.
2
;
double
pixel_length
;
int64_t
old_px_len_rounded
;
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
old_px_len_rounded
=
this
->
pixel_length
;
if
(
!
strcmp
(
notification
,
"scrollup"
))
mul
=
1
/
mul
;
again:
pixel_length
=
this
->
pixel_length
*
mul
;
if
(
pixel_length
<
1
)
pixel_length
=
1
;
if
(
pixel_length
>
(
double
)
3600
*
1000000000
)
...
...
@@ -169,6 +177,16 @@ static void scroll(void *private, gui *g,
this
->
pixel_length
=
pixel_length
;
/* due to rounding, we may need to zoom by more than 1.2 with
* very close lookup, otherwise the user zooming command won't
* be visible (say length is 2.7, zoom in, new length is 2.25,
* and rounding is 2, same value, no change, no feedback to user => bad)
* TODO: make all this cleaner
*/
if
(
pixel_length
!=
1
&&
pixel_length
!=
(
double
)
3600
*
1000000000
&&
(
int64_t
)
pixel_length
==
old_px_len_rounded
)
goto
again
;
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
}
...
...
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