PropagationBenchmarkFixture.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #if defined(HAVE_BENCHMARK)
  9. #pragma once
  10. #include <AzToolsFramework/Prefab/PrefabDomUtils.h>
  11. #include <AzToolsFramework/ToolsComponents/EditorInspectorComponent.h>
  12. #include <Prefab/Benchmark/PrefabBenchmarkFixture.h>
  13. namespace Benchmark
  14. {
  15. using namespace AzToolsFramework::Prefab;
  16. //! This class captures benchmarks for propagating changes to a single prefab instance with multiple entities that are side-by-side.
  17. class PropagationBenchmarkFixture : public Benchmark::BM_Prefab
  18. {
  19. protected:
  20. void UpdateTemplate();
  21. void UpdateComponent(benchmark::State& state);
  22. void AddComponent(benchmark::State& state);
  23. void RemoveComponent(benchmark::State& state);
  24. void AddEntity(benchmark::State& state);
  25. void RemoveEntity(benchmark::State& state);
  26. void AddNestedInstance(benchmark::State& state, TemplateId nestedPrefabTemplateId);
  27. void RemoveNestedInstance(benchmark::State& state, TemplateId nestedPrefabTemplateId);
  28. AZ::Entity* m_entityToModify = nullptr;
  29. AZStd::unique_ptr<Instance> m_instanceCreated;
  30. // The prefab instance to modify for the benchmark test. This can be m_instanceCreated or any nested prefab instance within it.
  31. Instance* m_instanceToModify = nullptr;
  32. AZStd::unique_ptr<Instance> m_instanceToUseForPropagation;
  33. };
  34. } // namespace Benchmark
  35. #endif