• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 #ifndef SRC_TRACE_PROCESSOR_VIEWS_SLICE_VIEWS_H_
18 #define SRC_TRACE_PROCESSOR_VIEWS_SLICE_VIEWS_H_
19 
20 #include "src/trace_processor/db/view.h"
21 #include "src/trace_processor/tables/metadata_tables_py.h"
22 #include "src/trace_processor/tables/slice_tables_py.h"
23 #include "src/trace_processor/tables/track_tables_py.h"
24 #include "src/trace_processor/views/macros.h"
25 
26 namespace perfetto {
27 namespace trace_processor {
28 namespace views {
29 
30 #define PERFETTO_TP_SLICE_TABLE_DEF(NAME, PARENT, C)  \
31   NAME(SliceTable, "internal_slice")                  \
32   C(int64_t, ts, Column::Flag::kSorted)               \
33   C(int64_t, dur)                                     \
34   C(TrackTable::Id, track_id)                         \
35   C(std::optional<StringPool::Id>, category)          \
36   C(std::optional<StringPool::Id>, name)              \
37   C(uint32_t, depth)                                  \
38   C(int64_t, stack_id)                                \
39   C(int64_t, parent_stack_id)                         \
40   C(std::optional<SliceTable::Id>, parent_id)         \
41   C(uint32_t, arg_set_id)                             \
42   C(std::optional<int64_t>, thread_ts)                \
43   C(std::optional<int64_t>, thread_dur)               \
44   C(std::optional<int64_t>, thread_instruction_count) \
45   C(std::optional<int64_t>, thread_instruction_delta)
46 
47 // TODO(lalitm): add support in document generator for views.
48 #define PERFETTO_TP_THREAD_SLICE_VIEW_DEF(NAME, FROM, JOIN, COL, FCOL)      \
49   NAME(ThreadSliceView, "exp_thread_slice")                                 \
50   PERFETTO_TP_VIEW_EXPORT_FROM_COLS(PERFETTO_TP_SLICE_TABLE_DEF, FCOL)      \
51   COL(utid, track, utid)                                                    \
52   COL(thread_name, thread, name)                                            \
53   COL(upid, thread, upid)                                                   \
54   FROM(tables::SliceTable, slice)                                           \
55   JOIN(tables::ThreadTrackTable, track, id, slice, track_id, View::kNoFlag) \
56   JOIN(tables::ThreadTable, thread, id, track, utid,                        \
57        View::kIdAlwaysPresent | View::kTypeCheckSerialized)
58 
59 PERFETTO_TP_DECLARE_VIEW(PERFETTO_TP_THREAD_SLICE_VIEW_DEF);
60 
61 }  // namespace views
62 }  // namespace trace_processor
63 }  // namespace perfetto
64 
65 #endif  // SRC_TRACE_PROCESSOR_VIEWS_SLICE_VIEWS_H_
66