Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OAI-RAN-5G-sheduler_MaxTBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAQ5G-PFC
OAI-RAN-5G-sheduler_MaxTBS
Commits
3a622778
Commit
3a622778
authored
8 years ago
by
Cedric Roux
Browse files
Options
Downloads
Patches
Plain Diff
basic event compression
parent
e4e46473
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/utils/T/tracer/gui/event.c
+45
-2
45 additions, 2 deletions
common/utils/T/tracer/gui/event.c
with
45 additions
and
2 deletions
common/utils/T/tracer/gui/event.c
+
45
−
2
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
;
process_event
(
g
,
cur
->
item
);
free_event
(
cur
->
item
);
if
(
cur
->
item
!=
NULL
)
{
process_event
(
g
,
cur
->
item
);
free_event
(
cur
->
item
);
}
free
(
cur
);
}
LOGD
(
"gui_events DONE
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment