Compositor: Improve reports to the interface about what's going on
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 27 Mar 2015 09:38:02 +0000 (14:38 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 27 Mar 2015 09:38:02 +0000 (14:38 +0500)
The functionality was got lost when new compositor system was landed
and it wasn't always clear what's causing the hicucps. Now it's nicely
reported to the stats line.

source/blender/compositor/intern/COM_ExecutionGroup.cpp
source/blender/compositor/intern/COM_ExecutionGroup.h
source/blender/compositor/intern/COM_ExecutionSystem.cpp
source/blender/compositor/intern/COM_compositor.cpp

index 366c97b50c6f28e9bad7ddc3031ec525a02e562e..a122d5d99889d326f532a1bd48c47370de98fa7b 100644 (file)
@@ -377,35 +377,6 @@ 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;
-       double execution_time;
-       char timestr[64];
-
-       execution_time = PIL_check_seconds_timer() - this->m_executionStartTime;
-
-       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);
-
-       BLI_timestr(execution_time, timestr, sizeof(timestr));
-       printf("| Elapsed %s ", timestr);
-       printf("| Tree %s, Tile %u-%u ", 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)
@@ -430,8 +401,11 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
                progress /= this->m_numberOfChunks;
                this->m_bTree->progress(this->m_bTree->prh, progress);
 
-               if (G.background)
-                       printBackgroundStats();
+               char buf[128];
+               BLI_snprintf(buf, sizeof(buf), "Compositing | Tile %d-%d",
+                            this->m_chunksFinished,
+                            this->m_numberOfChunks);
+               this->m_bTree->stats_draw(this->m_bTree->sdh, buf);
        }
 }
 
index 4b6f51c72c083b4bd3a5127d1fecfa26b745ae59..99365cdd4a86e2cfb0d46c8b35765ce21ce805d4 100644 (file)
@@ -346,11 +346,6 @@ public:
         */
        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.
         * @param chunknumber
index 0667271f4b18daa6f3d780b7d4d777898c88bf60..1f8b76547864def0eb47c1c9c3522da47106eb44 100644 (file)
@@ -76,6 +76,8 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editin
                                 viewer_border->xmin < viewer_border->xmax &&
                                 viewer_border->ymin < viewer_border->ymax;
 
+       editingtree->stats_draw(editingtree->sdh, (char*)"Compositing | Determining resolution");
+
        for (index = 0; index < this->m_groups.size(); index++) {
                resolution[0] = 0;
                resolution[1] = 0;
@@ -124,6 +126,9 @@ void ExecutionSystem::set_operations(const Operations &operations, const Groups
 
 void ExecutionSystem::execute()
 {
+       const bNodeTree *editingtree = this->m_context.getbNodeTree();
+       editingtree->stats_draw(editingtree->sdh, (char*)"Compositing | Initializing execution");
+
        DebugInfo::execute_started(this);
        
        unsigned int order = 0;
@@ -178,6 +183,7 @@ void ExecutionSystem::execute()
        WorkScheduler::finish();
        WorkScheduler::stop();
 
+       editingtree->stats_draw(editingtree->sdh, (char*)"Compositing | Deinitializing execution");
        for (index = 0; index < this->m_operations.size(); index++) {
                NodeOperation *operation = this->m_operations[index];
                operation->deinitExecution();
index ec9ef6c7e68f08c8859803a2a88974742a215afc..3348e7c73d888bd61561755a444eb24800575dad 100644 (file)
@@ -77,6 +77,7 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rende
 
        /* set progress bar to 0% and status to init compositing */
        editingtree->progress(editingtree->prh, 0.0);
+       editingtree->stats_draw(editingtree->sdh, (char*)"Compositing");
 
        bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering;
        /* initialize execution system */