Compositor: Improve reports to the interface about what's going on

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.
This commit is contained in:
Sergey Sharybin 2015-03-27 14:38:02 +05:00
parent a12b2ec66d
commit 408a2a8420
4 changed files with 12 additions and 36 deletions

View 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);
}
}

View 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

View 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();

View 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 */