1 /*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
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 #include "perfetto/tracing/internal/track_event_interned_fields.h"
18
19 namespace perfetto {
20 namespace internal {
21
22 InternedEventCategory::~InternedEventCategory() = default;
23
24 // static
Add(protos::pbzero::InternedData * interned_data,size_t iid,const char * value,size_t length)25 void InternedEventCategory::Add(protos::pbzero::InternedData* interned_data,
26 size_t iid,
27 const char* value,
28 size_t length) {
29 auto category = interned_data->add_event_categories();
30 category->set_iid(iid);
31 category->set_name(value, length);
32 }
33
34 InternedEventName::~InternedEventName() = default;
35
36 // static
Add(protos::pbzero::InternedData * interned_data,size_t iid,const char * value)37 void InternedEventName::Add(protos::pbzero::InternedData* interned_data,
38 size_t iid,
39 const char* value) {
40 auto name = interned_data->add_event_names();
41 name->set_iid(iid);
42 name->set_name(value);
43 }
44
45 InternedDebugAnnotationName::~InternedDebugAnnotationName() = default;
46
47 // static
Add(protos::pbzero::InternedData * interned_data,size_t iid,const char * value)48 void InternedDebugAnnotationName::Add(
49 protos::pbzero::InternedData* interned_data,
50 size_t iid,
51 const char* value) {
52 auto name = interned_data->add_debug_annotation_names();
53 name->set_iid(iid);
54 name->set_name(value);
55 }
56
57 } // namespace internal
58 } // namespace perfetto
59