mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
ElapsedTime: rename function to all_lower
This commit is contained in:
parent
cf3ee7c2a5
commit
23e3397b2f
@ -8,14 +8,14 @@ namespace vcpkg
|
||||
class ElapsedTime
|
||||
{
|
||||
public:
|
||||
static ElapsedTime createStarted();
|
||||
static ElapsedTime create_started();
|
||||
|
||||
constexpr ElapsedTime() : m_startTick() {}
|
||||
constexpr ElapsedTime() : m_start_tick() {}
|
||||
|
||||
template <class TimeUnit>
|
||||
TimeUnit elapsed() const
|
||||
{
|
||||
return std::chrono::duration_cast<TimeUnit>(std::chrono::high_resolution_clock::now() - this->m_startTick);
|
||||
return std::chrono::duration_cast<TimeUnit>(std::chrono::high_resolution_clock::now() - this->m_start_tick);
|
||||
}
|
||||
|
||||
double microseconds() const
|
||||
@ -23,9 +23,9 @@ namespace vcpkg
|
||||
return elapsed<std::chrono::duration<double, std::micro>>().count();
|
||||
}
|
||||
|
||||
std::string toString() const;
|
||||
std::string to_string() const;
|
||||
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point m_startTick;
|
||||
std::chrono::high_resolution_clock::time_point m_start_tick;
|
||||
};
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace vcpkg::Commands::Build
|
||||
|
||||
const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake);
|
||||
|
||||
const ElapsedTime timer = ElapsedTime::createStarted();
|
||||
const ElapsedTime timer = ElapsedTime::create_started();
|
||||
|
||||
int return_code = System::cmd_execute_clean(command);
|
||||
auto buildtimeus = timer.microseconds();
|
||||
|
@ -41,12 +41,12 @@ namespace vcpkg::Commands::CI
|
||||
|
||||
std::vector<BuildResult> results;
|
||||
std::vector<std::chrono::milliseconds::rep> timing;
|
||||
const ElapsedTime timer = ElapsedTime::createStarted();
|
||||
const ElapsedTime timer = ElapsedTime::create_started();
|
||||
size_t counter = 0;
|
||||
const size_t package_count = install_plan.size();
|
||||
for (const package_spec_with_install_plan& action : install_plan)
|
||||
{
|
||||
const ElapsedTime build_timer = ElapsedTime::createStarted();
|
||||
const ElapsedTime build_timer = ElapsedTime::create_started();
|
||||
counter++;
|
||||
System::println("Starting package %d/%d: %s", counter, package_count, action.spec.toString());
|
||||
|
||||
@ -92,10 +92,10 @@ namespace vcpkg::Commands::CI
|
||||
System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what());
|
||||
results.back() = BuildResult::NULLVALUE;
|
||||
}
|
||||
System::println("Elapsed time for package %s: %s", action.spec, build_timer.toString());
|
||||
System::println("Elapsed time for package %s: %s", action.spec, build_timer.to_string());
|
||||
}
|
||||
|
||||
System::println("Total time taken: %s", timer.toString());
|
||||
System::println("Total time taken: %s", timer.to_string());
|
||||
|
||||
for (size_t i = 0; i < results.size(); i++)
|
||||
{
|
||||
|
@ -179,7 +179,7 @@ int wmain(const int argc, const wchar_t* const* const argv)
|
||||
if (argc == 0)
|
||||
std::abort();
|
||||
|
||||
g_timer = ElapsedTime::createStarted();
|
||||
g_timer = ElapsedTime::create_started();
|
||||
atexit([]()
|
||||
{
|
||||
auto elapsed_us = g_timer.microseconds();
|
||||
|
@ -49,14 +49,14 @@ namespace vcpkg
|
||||
return Strings::format("%.4g ns", nanos_as_double);
|
||||
}
|
||||
|
||||
ElapsedTime ElapsedTime::createStarted()
|
||||
ElapsedTime ElapsedTime::create_started()
|
||||
{
|
||||
ElapsedTime t;
|
||||
t.m_startTick = std::chrono::high_resolution_clock::now();
|
||||
t.m_start_tick = std::chrono::high_resolution_clock::now();
|
||||
return t;
|
||||
}
|
||||
|
||||
std::string ElapsedTime::toString() const
|
||||
std::string ElapsedTime::to_string() const
|
||||
{
|
||||
return format_time_userfriendly(elapsed<std::chrono::nanoseconds>());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user