MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / UpdateStats

Method UpdateStats

src/luxcore/luxcoreimpl.cpp:977–1111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

975}
976
977void RenderSessionImpl::UpdateStats() {
978 // It is not really correct to call UpdateStats() outside a Start()/Stop()
979 // however it is easy to avoid any harm if it is done.
980 if (!renderSession->IsStarted())
981 return;
982
983 //--------------------------------------------------------------------------
984 // Stats update
985 //--------------------------------------------------------------------------
986
987 // Film update may be required by some render engine to
988 // update statistics, convergence test and more
989 renderSession->renderEngine->UpdateFilm();
990
991 stats.Set(Property("stats.renderengine.total.raysec")(renderSession->renderEngine->GetTotalRaysSec()));
992 stats.Set(Property("stats.renderengine.total.samplesec")(renderSession->renderEngine->GetTotalSamplesSec()));
993 stats.Set(Property("stats.renderengine.total.samplecount")(renderSession->renderEngine->GetTotalSampleCount()));
994 stats.Set(Property("stats.renderengine.pass")(renderSession->renderEngine->GetPass()));
995 stats.Set(Property("stats.renderengine.time")(renderSession->renderEngine->GetRenderingTime()));
996 stats.Set(Property("stats.renderengine.convergence")(renderSession->film->GetConvergence()));
997
998 // Intersection devices statistics
999 const vector<IntersectionDevice *> &idevices = renderSession->renderEngine->GetIntersectionDevices();
1000
1001 // Replace all virtual devices with real
1002 vector<IntersectionDevice *> realDevices;
1003 for (size_t i = 0; i < idevices.size(); ++i) {
1004 VirtualIntersectionDevice *vdev = dynamic_cast<VirtualIntersectionDevice *>(idevices[i]);
1005 if (vdev) {
1006 const vector<IntersectionDevice *> &realDevs = vdev->GetRealDevices();
1007 realDevices.insert(realDevices.end(), realDevs.begin(), realDevs.end());
1008 } else
1009 realDevices.push_back(idevices[i]);
1010 }
1011
1012 boost::unordered_map<string, unsigned int> devCounters;
1013 Property devicesNames("stats.renderengine.devices");
1014 double totalPerf = 0.0;
1015 BOOST_FOREACH(IntersectionDevice *dev, realDevices) {
1016 const string &devName = dev->GetName();
1017
1018 // Append a device index for the case where the same device is used multiple times
1019 unsigned int index = devCounters[devName]++;
1020 const string uniqueName = devName + "-" + ToString(index);
1021 devicesNames.Add(uniqueName);
1022
1023 const string prefix = "stats.renderengine.devices." + uniqueName;
1024 totalPerf += dev->GetTotalPerformance();
1025 stats.Set(Property(prefix + ".performance.total")(dev->GetTotalPerformance()));
1026 stats.Set(Property(prefix + ".performance.serial")(dev->GetSerialPerformance()));
1027 stats.Set(Property(prefix + ".performance.dataparallel")(dev->GetDataParallelPerformance()));
1028 stats.Set(Property(prefix + ".memory.total")((u_longlong)dev->GetMaxMemory()));
1029 stats.Set(Property(prefix + ".memory.used")((u_longlong)dev->GetUsedMemory()));
1030 }
1031 stats.Set(devicesNames);
1032 stats.Set(Property("stats.renderengine.performance.total")(totalPerf));
1033
1034 // The explicit cast to size_t is required by VisualC++

Callers 7

RenderTestSceneFunction · 0.45
BatchRenderingFunction · 0.45
__HandleConnectionMethod · 0.45
StandardAnimTestFunction · 0.45
RunHaltTestMethod · 0.45
RunHaltEditTestMethod · 0.45

Calls 15

SetTilePropertiesFunction · 0.85
SetMethod · 0.80
GetTotalRaysSecMethod · 0.80
GetTotalSamplesSecMethod · 0.80
GetPassMethod · 0.80
GetRenderingTimeMethod · 0.80
GetConvergenceMethod · 0.80
GetFrameTimeMethod · 0.80
CheckPeriodicSaveMethod · 0.80
IsStartedMethod · 0.45
UpdateFilmMethod · 0.45
GetTotalSampleCountMethod · 0.45

Tested by 3

StandardAnimTestFunction · 0.36
RunHaltTestMethod · 0.36
RunHaltEditTestMethod · 0.36