0bfb1a68ef2516e6406a200d366f6d28e85e7ce8
[vpp.git] / perftool / cpel.h
1 /* 
2  *------------------------------------------------------------------
3  * Copyright (c) 2005-2016 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _CPEL_H_
18 #define _CPEL_H_ 1
19
20 typedef struct cpel_file_header_ {
21     unsigned char endian_version;
22     unsigned char pad;
23     unsigned short nsections;
24     unsigned int file_date;
25 } cpel_file_header_t;
26
27 #define CPEL_FILE_LITTLE_ENDIAN 0x80
28 #define CPEL_FILE_VERSION       0x01
29 #define CPEL_FILE_VERSION_MASK  0x7F
30
31 typedef struct cpel_section_header_ {
32     unsigned int section_type;
33     unsigned int data_length;        /* does NOT include type and itself */
34 } cpel_section_header_t;
35
36 #define CPEL_SECTION_STRTAB     1
37 /* string at offset 0 is the name of the table */
38
39 #define CPEL_SECTION_SYMTAB     2
40 #define CPEL_SECTION_EVTDEF     3
41
42 typedef struct event_definition_section_header_ {
43     char string_table_name[64];
44     unsigned int number_of_event_definitions;
45 } event_definition_section_header_t;
46
47 typedef struct event_definition_ {
48     unsigned int event;
49     unsigned int event_format;
50     unsigned int datum_format;
51 } event_definition_t;
52
53 #define CPEL_SECTION_TRACKDEF   4
54
55 typedef struct track_definition_section_header_ {
56     char string_table_name[64];
57     unsigned int number_of_track_definitions;
58 } track_definition_section_header_t;
59
60 typedef struct track_definition_ {
61     unsigned int track;
62     unsigned int track_format;
63 } track_definition_t;
64
65 #define CPEL_SECTION_EVENT      5
66
67 typedef struct event_section_header_ {
68     char string_table_name[64];
69     unsigned int number_of_events;
70     unsigned int clock_ticks_per_second;
71 } event_section_header_t;
72
73 typedef struct event_entry_ {
74     unsigned int time[2];
75     unsigned int track;
76     unsigned int event_code;
77     unsigned int event_datum;
78 } event_entry_t;
79
80 #define CPEL_NUM_SECTION_TYPES 5
81
82 #endif /* _CPEL_H_ */
83