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
1dff773e
Commit
1dff773e
authored
Jun 08, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 'and' filter operation
parent
72f56da6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
common/utils/T/tracer/filter/filter.c
common/utils/T/tracer/filter/filter.c
+21
-5
common/utils/T/tracer/filter/filter.h
common/utils/T/tracer/filter/filter.h
+1
-0
No files found.
common/utils/T/tracer/filter/filter.c
View file @
1dff773e
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
struct
filter
{
struct
filter
{
union
{
union
{
struct
{
struct
filter
*
a
,
*
b
;
}
eq
;
struct
{
struct
filter
*
a
,
*
b
;
}
op2
;
int
v
;
int
v
;
struct
{
int
event_type
;
int
arg_index
;
}
evarg
;
struct
{
int
event_type
;
int
arg_index
;
}
evarg
;
}
v
;
}
v
;
...
@@ -19,10 +19,16 @@ struct filter {
...
@@ -19,10 +19,16 @@ struct filter {
/* evaluation functions */
/* evaluation functions */
/****************************************************************************/
/****************************************************************************/
int
eval_and
(
struct
filter
*
f
,
event
e
)
{
if
(
f
->
v
.
op2
.
a
->
eval
(
f
->
v
.
op2
.
a
,
e
)
==
0
)
return
0
;
return
f
->
v
.
op2
.
b
->
eval
(
f
->
v
.
op2
.
b
,
e
);
}
int
eval_eq
(
struct
filter
*
f
,
event
e
)
int
eval_eq
(
struct
filter
*
f
,
event
e
)
{
{
int
a
=
f
->
v
.
eq
.
a
->
eval
(
f
->
v
.
eq
.
a
,
e
);
int
a
=
f
->
v
.
op2
.
a
->
eval
(
f
->
v
.
op2
.
a
,
e
);
int
b
=
f
->
v
.
eq
.
b
->
eval
(
f
->
v
.
eq
.
b
,
e
);
int
b
=
f
->
v
.
op2
.
b
->
eval
(
f
->
v
.
op2
.
b
,
e
);
return
a
==
b
;
return
a
==
b
;
}
}
...
@@ -49,13 +55,23 @@ int eval_evarg(struct filter *f, event e)
...
@@ -49,13 +55,23 @@ int eval_evarg(struct filter *f, event e)
/* filter construction functions */
/* filter construction functions */
/****************************************************************************/
/****************************************************************************/
filter
*
filter_and
(
filter
*
a
,
filter
*
b
)
{
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
ret
==
NULL
)
abort
();
ret
->
eval
=
eval_and
;
ret
->
v
.
op2
.
a
=
a
;
ret
->
v
.
op2
.
b
=
b
;
return
ret
;
}
filter
*
filter_eq
(
filter
*
a
,
filter
*
b
)
filter
*
filter_eq
(
filter
*
a
,
filter
*
b
)
{
{
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
ret
==
NULL
)
abort
();
if
(
ret
==
NULL
)
abort
();
ret
->
eval
=
eval_eq
;
ret
->
eval
=
eval_eq
;
ret
->
v
.
eq
.
a
=
a
;
ret
->
v
.
op2
.
a
=
a
;
ret
->
v
.
eq
.
b
=
b
;
ret
->
v
.
op2
.
b
=
b
;
return
ret
;
return
ret
;
}
}
...
...
common/utils/T/tracer/filter/filter.h
View file @
1dff773e
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
typedef
void
filter
;
typedef
void
filter
;
filter
*
filter_and
(
filter
*
a
,
filter
*
b
);
filter
*
filter_eq
(
filter
*
a
,
filter
*
b
);
filter
*
filter_eq
(
filter
*
a
,
filter
*
b
);
filter
*
filter_int
(
int
v
);
filter
*
filter_int
(
int
v
);
filter
*
filter_evarg
(
void
*
database
,
char
*
event_name
,
char
*
varname
);
filter
*
filter_evarg
(
void
*
database
,
char
*
event_name
,
char
*
varname
);
...
...
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