mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Merge pull request #261 from diamante0018/main
feat: track time spent linking zone
This commit is contained in:
commit
568e6572fb
@ -7,6 +7,10 @@
|
|||||||
#include "Game/T6/ZoneWriterFactoryT6.h"
|
#include "Game/T6/ZoneWriterFactoryT6.h"
|
||||||
#include "Writing/IZoneWriterFactory.h"
|
#include "Writing/IZoneWriterFactory.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <format>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
IZoneWriterFactory* ZoneWriterFactories[]{
|
IZoneWriterFactory* ZoneWriterFactories[]{
|
||||||
new IW3::ZoneWriterFactory(),
|
new IW3::ZoneWriterFactory(),
|
||||||
new IW4::ZoneWriterFactory(),
|
new IW4::ZoneWriterFactory(),
|
||||||
@ -17,6 +21,8 @@ IZoneWriterFactory* ZoneWriterFactories[]{
|
|||||||
|
|
||||||
bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone)
|
bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone)
|
||||||
{
|
{
|
||||||
|
const auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
std::unique_ptr<ZoneWriter> zoneWriter;
|
std::unique_ptr<ZoneWriter> zoneWriter;
|
||||||
for (auto* factory : ZoneWriterFactories)
|
for (auto* factory : ZoneWriterFactories)
|
||||||
{
|
{
|
||||||
@ -29,9 +35,15 @@ bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone)
|
|||||||
|
|
||||||
if (zoneWriter == nullptr)
|
if (zoneWriter == nullptr)
|
||||||
{
|
{
|
||||||
printf("Could not create ZoneWriter for zone '%s'.\n", zone->m_name.c_str());
|
std::cerr << std::format("Could not create ZoneWriter for zone \"{}\".\n", zone->m_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return zoneWriter->WriteZone(stream);
|
const auto result = zoneWriter->WriteZone(stream);
|
||||||
|
|
||||||
|
const auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
std::cout << std::format("Writing zone \"{}\" took {} ms.\n", zone->m_name, std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user