diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-12 18:28:52 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-03-12 18:28:52 +0400 |
commit | 984bd7ffa82ca4c674a7d4a6a5b5504787335533 (patch) | |
tree | 1079903face811ba6397199f19a3091072d350f6 /source/blender/compositor/intern | |
parent | 96412b711e250bf41e075c417eb5845a8916529c (diff) |
Print compositor execution statistics when in background mode
This will print memory usage, mapped memory usage, memory peak,
compositing tree name and number of finished tiles to stdout
when blender is rendering in background mode.
This makes compositor a less blackbox and should help trouble
shooting issues happening during 4K ToS project.
Diffstat (limited to 'source/blender/compositor/intern')
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionGroup.cpp | 27 | ||||
-rw-r--r-- | source/blender/compositor/intern/COM_ExecutionGroup.h | 5 |
2 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 6d01e2f7824..7d34db1d933 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -40,6 +40,7 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" +#include "BKE_global.h" #include "PIL_time.h" #include "WM_api.h" #include "WM_types.h" @@ -410,6 +411,29 @@ MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *mem return result; } +void ExecutionGroup::printBackgroundStats(void) +{ + uintptr_t mem_in_use, mmap_in_use, peak_memory; + float megs_used_memory, mmap_used_memory, megs_peak_memory; + + mem_in_use = MEM_get_memory_in_use(); + mmap_in_use = MEM_get_mapped_memory_in_use(); + peak_memory = MEM_get_peak_memory(); + + megs_used_memory = (mem_in_use - mmap_in_use) / (1024.0 * 1024.0); + mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0); + megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); + + fprintf(stdout, "Mem:%.2fM (%.2fM, Peak %.2fM) ", + megs_used_memory, mmap_used_memory, megs_peak_memory); + + printf("| Tree %s, Tile %d-%d ", this->m_bTree->id.name + 2, + this->m_chunksFinished, this->m_numberOfChunks); + + fputc('\n', stdout); + fflush(stdout); +} + void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers) { if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) @@ -433,6 +457,9 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo float progress = this->m_chunksFinished; progress /= this->m_numberOfChunks; this->m_bTree->progress(this->m_bTree->prh, progress); + + if (G.background) + printBackgroundStats(); } } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 52f5bae4be9..b5952611c1b 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -341,6 +341,11 @@ public: * @see determineChunkRect */ MemoryBuffer *allocateOutputBuffer(int chunkNumber, rcti *rect); + + /** + * @brief print execution statistics to stdout when running in a background mode + */ + void printBackgroundStats(void); /** * @brief after a chunk is executed the needed resources can be freed or unlocked. |