FD.io VPP
v16.06
Vector Packet Processing
Main Page
Related Pages
Data Structures
Source
Files
Symbols
elog_samples.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
#include <
vlib/vlib.h
>
17
#include <
vppinfra/elog.h
>
18
19
static
inline
void
elog_four_int_sample
(
u32
*data)
20
{
21
ELOG_TYPE_DECLARE
(e) =
22
{
23
.format =
"four int: first %d second %d third %d fourth %d"
,
24
.format_args =
"i4i4i4i4"
,
25
};
26
struct
{
u32
data[4];} * ed;
27
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, e);
28
ed->data[0] = data[0];
29
ed->data[1] = data[1];
30
ed->data[2] = data[2];
31
ed->data[3] = data[3];
32
}
33
34
static
inline
void
elog_four_int_track_sample
(
u32
*data)
35
{
36
ELOG_TYPE_DECLARE
(e) =
37
{
38
.format =
"four_int_track: first %d second %d third %d fourth %d"
,
39
.format_args =
"i4i4i4i4"
,
40
};
41
struct
{
u32
data[4];} * ed;
42
ELOG_TRACK
(sample_track);
43
ed =
ELOG_TRACK_DATA
(&
vlib_global_main
.
elog_main
, e, sample_track);
44
ed->data[0] = data[0];
45
ed->data[1] = data[1];
46
ed->data[2] = data[2];
47
ed->data[3] = data[3];
48
}
49
50
static
inline
void
elog_enum_sample
(
u8
which)
51
{
52
ELOG_TYPE_DECLARE
(e) =
53
{
54
.format =
"my enum: %s"
,
55
.format_args =
"t1"
,
56
.n_enum_strings = 2,
57
.enum_strings =
58
{
59
"string 1"
,
60
"string 2"
,
61
},
62
};
63
struct
{
u8
which;} * ed;
64
ed =
ELOG_DATA
(&
vlib_global_main
.
elog_main
, e);
65
ed->which = which;
66
}
67
68
static
inline
void
elog_one_datum_sample
(
u32
data)
69
{
70
ELOG_TYPE_DECLARE
(e) =
71
{
72
.format =
"one datum: %d"
,
73
.format_args =
"i4"
,
74
};
75
76
elog
(&
vlib_global_main
.
elog_main
, &e, data);
77
}
78
79
static
clib_error_t
*
80
test_elog_command_fn
(
vlib_main_t
* vm,
81
unformat_input_t
* input,
82
vlib_cli_command_t
* cmd)
83
{
84
int
i
;
85
u32
samples[4];
86
87
for
(i = 0; i < 10; i++)
88
{
89
samples[0] =
i
;
90
samples[1] = i+1;
91
samples[2] = i+2;
92
samples[3] = i+3;
93
94
elog_four_int_sample
(samples);
95
elog_four_int_track_sample
(samples);
96
elog_enum_sample
(0);
97
elog_enum_sample
(1);
98
elog_one_datum_sample
(i);
99
}
100
101
return
0;
102
}
103
104
VLIB_CLI_COMMAND
(test_elog_command,
static
) = {
105
.path =
"test elog sample"
,
106
.short_help =
"test elog sample"
,
107
.function =
test_elog_command_fn
,
108
};
i
sll srl srl sll sra u16x4 i
Definition:
vector_sse2.h:267
test_elog_command_fn
static clib_error_t * test_elog_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition:
elog_samples.c:80
elog_four_int_sample
static void elog_four_int_sample(u32 *data)
Definition:
elog_samples.c:19
elog
always_inline void elog(elog_main_t *em, elog_event_type_t *type, u32 data)
Definition:
elog.h:278
ELOG_TRACK
#define ELOG_TRACK(f)
Definition:
elog.h:373
ELOG_DATA
#define ELOG_DATA(em, f)
Definition:
elog.h:386
elog.h
elog_four_int_track_sample
static void elog_four_int_track_sample(u32 *data)
Definition:
elog_samples.c:34
vlib_main_t::elog_main
elog_main_t elog_main
Definition:
main.h:141
vlib_global_main
vlib_main_t vlib_global_main
Definition:
main.c:1505
ELOG_TYPE_DECLARE
#define ELOG_TYPE_DECLARE(f)
Definition:
elog.h:344
vlib.h
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition:
cli.h:150
u32
unsigned int u32
Definition:
types.h:88
ELOG_TRACK_DATA
#define ELOG_TRACK_DATA(em, f, track)
Definition:
elog.h:380
clib_error_t
Definition:
error.h:75
u8
unsigned char u8
Definition:
types.h:56
vlib_main_t
Definition:
main.h:59
vlib_cli_command_t
Definition:
cli.h:88
unformat_input_t
struct _unformat_input_t unformat_input_t
elog_enum_sample
static void elog_enum_sample(u8 which)
Definition:
elog_samples.c:50
elog_one_datum_sample
static void elog_one_datum_sample(u32 data)
Definition:
elog_samples.c:68
vlib
vlib
elog_samples.c
Generated on Thu Sep 1 2016 09:11:28 for FD.io VPP by
1.8.11