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
3a622778
Commit
3a622778
authored
May 02, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic event compression
parent
e4e46473
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
common/utils/T/tracer/gui/event.c
common/utils/T/tracer/gui/event.c
+45
-2
No files found.
common/utils/T/tracer/gui/event.c
View file @
3a622778
...
...
@@ -39,6 +39,24 @@ static void free_event(struct event *e)
free
(
e
);
}
static
int
events_equal
(
struct
event
*
e1
,
struct
event
*
e2
)
{
if
(
e1
->
type
!=
e2
->
type
)
return
0
;
switch
(
e1
->
type
)
{
case
REPACK
:
{
struct
repack_event
*
re1
=
(
struct
repack_event
*
)
e1
;
struct
repack_event
*
re2
=
(
struct
repack_event
*
)
e2
;
return
re1
->
id
==
re2
->
id
;
}
case
DIRTY
:
{
struct
dirty_event
*
re1
=
(
struct
dirty_event
*
)
e1
;
struct
dirty_event
*
re2
=
(
struct
dirty_event
*
)
e2
;
return
re1
->
id
==
re2
->
id
;
}}
/* unreachable */
abort
();
}
/*****************************************************************/
/* sending events */
/*****************************************************************/
...
...
@@ -61,6 +79,28 @@ static event *new_event_dirty(int id)
return
ret
;
}
static
void
compress_event_list
(
struct
gui
*
g
)
{
struct
event
*
last
;
struct
event_list
*
cur
;
/* basic compression, to be refined */
/* pickup last event and remove every copy of it found before
* if it's DIRTY or REPACK
*/
last
=
g
->
queued_events
->
last
->
item
;
if
(
last
->
type
==
DIRTY
||
last
->
type
==
REPACK
)
{
cur
=
g
->
queued_events
;
while
(
cur
->
item
!=
last
)
{
if
(
cur
->
item
!=
NULL
&&
events_equal
(
cur
->
item
,
last
))
{
free_event
(
cur
->
item
);
cur
->
item
=
NULL
;
}
cur
=
cur
->
next
;
}
}
}
void
send_event
(
gui
*
_gui
,
enum
event_type
type
,
...)
{
LOGD
(
"send_event %d
\n
"
,
type
);
...
...
@@ -93,6 +133,7 @@ void send_event(gui *_gui, enum event_type type, ...)
e
->
type
=
type
;
event_list_append
(
g
,
e
);
compress_event_list
(
g
);
if
(
do_write
)
{
char
c
=
1
;
...
...
@@ -158,8 +199,10 @@ void gui_events(gui *_gui)
struct
event_list
*
cur
=
g
->
queued_events
;
g
->
queued_events
=
cur
->
next
;
if
(
g
->
queued_events
)
g
->
queued_events
->
last
=
cur
->
last
;
if
(
cur
->
item
!=
NULL
)
{
process_event
(
g
,
cur
->
item
);
free_event
(
cur
->
item
);
}
free
(
cur
);
}
LOGD
(
"gui_events DONE
\n
"
);
...
...
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