bool LoadWholePackage(UnPackage* Package, IProgressCallback* progress) { guard(LoadWholePackage); if (GFullyLoadedPackages.FindItem(Package) >= 0) return true; // already loaded #if PROFILE appResetProfiler(); #endif UObject::BeginLoad(); for (int idx = 0; idx < Package->Summary.ExportCount; idx++) { if (!IsKnownClass(Package->GetObjectName(Package->GetExport(idx).ClassIndex))) continue; if (progress && !progress->Tick()) return false; Package->CreateExport(idx); } UObject::EndLoad(); GFullyLoadedPackages.Add(Package); #if PROFILE appPrintProfiler(); #endif return true; unguardf("%s", Package->Name); }
void appPrintProfiler() { if (ProfileStartTime == -1) return; float timeDelta = (appMilliseconds() - ProfileStartTime) / 1000.0f; if (timeDelta < 0.001f && !GNumAllocs && !GSerializeBytes && !GNumSerialize) return; // perhaps already printed? appPrintf("Loaded in %.2g sec, %d allocs, %.2f MBytes serialized in %d calls.\n", timeDelta, GNumAllocs, GSerializeBytes / (1024.0f * 1024.0f), GNumSerialize); appResetProfiler(); }
void appPrintProfiler(const char* label) { if (ProfileStartTime == -1) return; float timeDelta = (appMilliseconds() - ProfileStartTime) / 1000.0f; if (timeDelta < 0.001f && !GNumAllocs && !GSerializeBytes && !GNumSerialize) return; // nothing to print (perhaps already printed?) appPrintf("%s in %.1f sec, %d allocs, %.2f MBytes serialized in %d calls.\n", label ? label : "Loaded", timeDelta, GNumAllocs, GSerializeBytes / (1024.0f * 1024.0f), GNumSerialize); appResetProfiler(); }