Add ability to time captured benchmarks (#1569)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1569

Added a `benchmark` function that takes a path representing a directory to read captures from. This is supplied by the caller due to annoyance with filesystem access in C++. This calls into timing code with <chrono> and prints it out to the console.

Reviewed By: NickGerleman

Differential Revision: D53104632

fbshipit-source-id: fe8bcb0a87198701865fb04193894591d2eff821
This commit is contained in:
Joe Vilches
2024-02-05 11:48:07 -08:00
committed by Facebook GitHub Bot
parent 0ca15bdaaa
commit 8dbf55f230
2 changed files with 67 additions and 3 deletions

View File

@@ -7,11 +7,14 @@
#pragma once
#include <filesystem>
#include <chrono>
#include <string>
namespace facebook::yoga {
void generateBenchmark(const std::filesystem::path& capturePath);
struct BenchmarkResult {
std::chrono::steady_clock::duration treeCreationDuration;
std::chrono::steady_clock::duration layoutDuration;
};
} // namespace facebook::yoga