xref: /aosp_15_r20/test/dittosuite/include/ditto/instruction_set.h (revision 6fa2df46f119dce7527f5beb2814eca0e6f886ac)
1*6fa2df46SAndroid Build Coastguard Worker // Copyright (C) 2021 The Android Open Source Project
2*6fa2df46SAndroid Build Coastguard Worker //
3*6fa2df46SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*6fa2df46SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*6fa2df46SAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*6fa2df46SAndroid Build Coastguard Worker //
7*6fa2df46SAndroid Build Coastguard Worker //      http://www.apache.org/licenses/LICENSE-2.0
8*6fa2df46SAndroid Build Coastguard Worker //
9*6fa2df46SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*6fa2df46SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*6fa2df46SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*6fa2df46SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*6fa2df46SAndroid Build Coastguard Worker // limitations under the License.
14*6fa2df46SAndroid Build Coastguard Worker 
15*6fa2df46SAndroid Build Coastguard Worker #pragma once
16*6fa2df46SAndroid Build Coastguard Worker 
17*6fa2df46SAndroid Build Coastguard Worker #include <cstdint>
18*6fa2df46SAndroid Build Coastguard Worker #include <memory>
19*6fa2df46SAndroid Build Coastguard Worker #include <random>
20*6fa2df46SAndroid Build Coastguard Worker #include <vector>
21*6fa2df46SAndroid Build Coastguard Worker 
22*6fa2df46SAndroid Build Coastguard Worker #include <ditto/instruction.h>
23*6fa2df46SAndroid Build Coastguard Worker 
24*6fa2df46SAndroid Build Coastguard Worker namespace dittosuite {
25*6fa2df46SAndroid Build Coastguard Worker 
26*6fa2df46SAndroid Build Coastguard Worker class InstructionSet : public Instruction {
27*6fa2df46SAndroid Build Coastguard Worker  public:
28*6fa2df46SAndroid Build Coastguard Worker   inline static const std::string kName = "instruction_set";
29*6fa2df46SAndroid Build Coastguard Worker 
30*6fa2df46SAndroid Build Coastguard Worker   explicit InstructionSet(const Params& params,
31*6fa2df46SAndroid Build Coastguard Worker                           std::vector<std::unique_ptr<Instruction>> instructions, int list_key,
32*6fa2df46SAndroid Build Coastguard Worker                           int item_key, Order order, Reseeding reseeding, uint32_t seed);
33*6fa2df46SAndroid Build Coastguard Worker   explicit InstructionSet(const Params& params,
34*6fa2df46SAndroid Build Coastguard Worker                           std::vector<std::unique_ptr<Instruction>> instructions);
35*6fa2df46SAndroid Build Coastguard Worker 
36*6fa2df46SAndroid Build Coastguard Worker   std::unique_ptr<Result> CollectResults(const std::string& prefix) override;
37*6fa2df46SAndroid Build Coastguard Worker 
38*6fa2df46SAndroid Build Coastguard Worker  private:
39*6fa2df46SAndroid Build Coastguard Worker   void SetUp() override;
40*6fa2df46SAndroid Build Coastguard Worker   void SetUpSingle() override;
41*6fa2df46SAndroid Build Coastguard Worker   void RunSingle() override;
42*6fa2df46SAndroid Build Coastguard Worker   void RunInstructions();
43*6fa2df46SAndroid Build Coastguard Worker 
44*6fa2df46SAndroid Build Coastguard Worker   std::vector<std::unique_ptr<Instruction>> instructions_;
45*6fa2df46SAndroid Build Coastguard Worker   int list_key_;
46*6fa2df46SAndroid Build Coastguard Worker   int item_key_;
47*6fa2df46SAndroid Build Coastguard Worker   Order access_order_;
48*6fa2df46SAndroid Build Coastguard Worker   Reseeding reseeding_;
49*6fa2df46SAndroid Build Coastguard Worker   uint32_t seed_;
50*6fa2df46SAndroid Build Coastguard Worker   std::mt19937_64 gen_;
51*6fa2df46SAndroid Build Coastguard Worker };
52*6fa2df46SAndroid Build Coastguard Worker 
53*6fa2df46SAndroid Build Coastguard Worker }  // namespace dittosuite
54