/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "src/trace_processor/types/task_state.h" #include <string.h> #include "perfetto/base/logging.h" namespace perfetto { namespace trace_processor { namespace ftrace_utils { // static TaskState TaskState::FromRawPrevState( uint16_t raw_state, std::optional<VersionNumber> kernel_version) { … } // static TaskState TaskState::FromSystrace(const char* state_str) { … } // static TaskState TaskState::FromParsedFlags(uint16_t parsed_state) { … } // See header for extra details. // // Note to maintainers: going forward, the most likely "breaking" changes are: // * a new flag is added to TASK_REPORT (see include/linux/sched.h kernel src) // * a new report-specific flag is added above TASK_REPORT // In both cases, this will change the value of TASK_REPORT_MAX that is used to // report preemption in sched_switch. We'll need to modify this class to keep // up, or make traced_probes record the sched_switch format string in traces. // // Note to maintainers: if changing the default kernel assumption or the 4.4 // codepath, you'll need to update ToRawStateOnlyForSystraceConversions(). TaskState::TaskState(uint16_t raw_state, std::optional<VersionNumber> opt_version) { … } TaskState::TaskStateStr TaskState::ToString(char separator) const { … } // Used when parsing systrace, i.e. textual ftrace output. TaskState::TaskState(const char* state_str) { … } // Hard-assume 4.4 flag layout per the header rationale. uint16_t TaskState::ToRawStateOnlyForSystraceConversions() const { … } } // namespace ftrace_utils } // namespace trace_processor } // namespace perfetto