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
alex037yang
OpenXG-RAN
Commits
1b0c0f7b
Commit
1b0c0f7b
authored
Dec 05, 2016
by
Cedric Roux
Committed by
Raymond Knopp
Jan 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
T: new view 'scolltti'
This view is used to display throughput (to come in next commits).
parent
83004b05
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
1 deletion
+103
-1
common/utils/T/tracer/view/Makefile
common/utils/T/tracer/view/Makefile
+1
-1
common/utils/T/tracer/view/scrolltti.c
common/utils/T/tracer/view/scrolltti.c
+100
-0
common/utils/T/tracer/view/view.h
common/utils/T/tracer/view/view.h
+2
-0
No files found.
common/utils/T/tracer/view/Makefile
View file @
1b0c0f7b
CC
=
gcc
CFLAGS
=
-Wall
-g
-pthread
-I
..
-I
../logger
OBJS
=
stdout.o textlist.o xy.o tti.o time.o ticktime.o
OBJS
=
stdout.o textlist.o xy.o tti.o time.o ticktime.o
scrolltti.o
view.a
:
$(OBJS)
ar cr view.a
$(OBJS)
...
...
common/utils/T/tracer/view/scrolltti.c
0 → 100644
View file @
1b0c0f7b
#include "view.h"
#include "../utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
struct
scrolltti
{
view
common
;
gui
*
g
;
widget
*
w
;
widget
*
throughput_textarea
;
int
plot
;
float
refresh_rate
;
pthread_mutex_t
lock
;
unsigned
long
data
[
1000
];
unsigned
long
total
;
/* sum data[0..999] to have smoother value printed */
float
xout
[
1000
];
float
yout
[
1000
];
int
insert_point
;
};
/* this array is used to get Y range 1000, 2000, 5000, 10000, ... */
static
int
tolog
[
11
]
=
{
-
1
,
1
,
2
,
5
,
5
,
5
,
10
,
10
,
10
,
10
,
10
};
static
void
*
scrolltti_thread
(
void
*
_this
)
{
struct
scrolltti
*
this
=
_this
;
int
i
;
int
p
;
float
max
,
mlog
;
char
o
[
64
];
while
(
1
)
{
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
/* TODO: optimize */
p
=
this
->
insert_point
;
max
=
0
;
for
(
i
=
0
;
i
<
1000
;
i
++
)
{
this
->
xout
[
i
]
=
i
;
this
->
yout
[
i
]
=
this
->
data
[
p
];
if
(
this
->
data
[
p
]
>
max
)
max
=
this
->
data
[
p
];
p
=
(
p
+
1
)
%
1000
;
}
bps
(
o
,
this
->
total
/
1000
.,
"b/s"
);
textarea_set_text
(
this
->
g
,
this
->
throughput_textarea
,
o
);
/* for Y range we want 1000, 2000, 5000, 10000, 20000, 50000, etc. */
if
(
max
<
1000
)
max
=
1000
;
mlog
=
pow
(
10
,
floor
(
log10
(
max
)));
max
=
tolog
[(
int
)
ceil
(
max
/
mlog
)]
*
mlog
;
xy_plot_set_range
(
this
->
g
,
this
->
w
,
0
,
1000
,
0
,
max
);
xy_plot_set_points
(
this
->
g
,
this
->
w
,
this
->
plot
,
1000
,
this
->
xout
,
this
->
yout
);
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
sleepms
(
1000
/
this
->
refresh_rate
);
}
return
0
;
}
static
void
clear
(
view
*
this
)
{
/* TODO */
}
static
void
append
(
view
*
_this
,
int
frame
,
int
subframe
,
double
value
)
{
struct
scrolltti
*
this
=
(
struct
scrolltti
*
)
_this
;
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
this
->
total
-=
this
->
data
[
this
->
insert_point
];
this
->
data
[
this
->
insert_point
]
=
value
;
this
->
total
+=
this
->
data
[
this
->
insert_point
];
this
->
insert_point
=
(
this
->
insert_point
+
1
)
%
1000
;
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
}
view
*
new_view_scrolltti
(
float
refresh_rate
,
gui
*
g
,
widget
*
w
,
int
color
,
widget
*
throughput_textarea
)
{
struct
scrolltti
*
ret
=
calloc
(
1
,
sizeof
(
struct
scrolltti
));
if
(
ret
==
NULL
)
abort
();
ret
->
common
.
clear
=
clear
;
ret
->
common
.
append
=
(
void
(
*
)(
view
*
,
...))
append
;
ret
->
refresh_rate
=
refresh_rate
;
ret
->
g
=
g
;
ret
->
w
=
w
;
ret
->
throughput_textarea
=
throughput_textarea
;
ret
->
plot
=
xy_plot_new_plot
(
g
,
w
,
color
);
if
(
pthread_mutex_init
(
&
ret
->
lock
,
NULL
))
abort
();
new_thread
(
scrolltti_thread
,
ret
);
return
(
view
*
)
ret
;
}
common/utils/T/tracer/view/view.h
View file @
1b0c0f7b
...
...
@@ -19,6 +19,8 @@ view *new_view_xy(int length, float refresh_rate, gui *g, widget *w,
int
color
,
enum
xy_mode
mode
);
view
*
new_view_tti
(
float
refresh_rate
,
gui
*
g
,
widget
*
w
,
int
color
);
view
*
new_view_scrolltti
(
float
refresh_rate
,
gui
*
g
,
widget
*
w
,
int
color
,
widget
*
throughput_label
);
view
*
new_view_time
(
int
number_of_seconds
,
float
refresh_rate
,
gui
*
g
,
widget
*
w
);
view
*
new_subview_time
(
view
*
time
,
int
line
,
int
color
,
int
size
);
...
...
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