// Copyright (C) 2023 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. #pragma once #include namespace dittosuite { class CpuWork : public Instruction { public: inline static const std::string kName; explicit CpuWork(const std::string &name, const Params& params); private: virtual void RunSingle() = 0; }; class CpuWorkCycles : public CpuWork { public: inline static const std::string kName = "cpu_work_cycles"; explicit CpuWorkCycles(const Params& params, uint64_t cycles); private: uint64_t cycles_; void RunSingle() override; }; class CpuWorkDurationUs : public CpuWork { public: inline static const std::string kName = "cpu_work_duration"; explicit CpuWorkDurationUs(const Params& params, uint64_t duration_us); private: timespec work_time_; void RunSingle() override; }; class CpuWorkUtilization : public CpuWork { public: inline static const std::string kName = "cpu_work_utilization"; explicit CpuWorkUtilization(const Params& params, double utilization); private: timespec work_time_; void RunSingle() override; }; } // namespace dittosuite