| // Copyright 2018 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <lib/fxl/logging.h> |
| |
| #include "verify_test.h" |
| |
| class UserFlagVerifier : public Verifier { |
| public: |
| static std::unique_ptr<Verifier> Create( |
| const cpuperf::SessionResultSpec* spec) { |
| return std::make_unique<UserFlagVerifier>(spec); |
| } |
| |
| UserFlagVerifier(const cpuperf::SessionResultSpec* spec) |
| : Verifier(spec) { |
| } |
| |
| private: |
| bool VerifyRecord(const cpuperf::SampleRecord& record) override { |
| // IWBN to verify we got a kernel pc here, but that doesn't always |
| // happen. There can be slippage to the time the event is reported. |
| return true; |
| } |
| |
| bool VerifyTrace(const RecordCounts& counts) override { |
| if (counts.value_records != 0) { |
| FXL_LOG(ERROR) << "Found unexpected value records"; |
| return false; |
| } |
| if (counts.pc_records == 0) { |
| FXL_LOG(ERROR) << "Expected pc records, none present"; |
| return false; |
| } |
| return true; |
| } |
| }; |
| |
| const TestSpec kUserFlagSpec = { |
| "user-flag", |
| &UserFlagVerifier::Create, |
| }; |