const ReStringList& calculate(const char* base, int depth,
void (*format)(const ReDirStatisticData& data, ReDirStatistic& parent,
ReByteBuffer& line) = formatLikeDu);
+ void setTraceInterval(int interval){
+ m_traceInterval = interval;
+ }
private:
ReStringList m_list;
+ int m_traceInterval;
+ time_t m_lastTrace;
};
* Constructor.
*/
ReDirStatistic::ReDirStatistic(int deltaList, int deltaBuffer) :
- m_list(deltaList, deltaBuffer)
+ m_list(deltaList, deltaBuffer),
+ m_traceInterval(0),
+ m_lastTrace(0)
{
}
/**
ReDirStatisticData* current = dataStack[0];
current->m_path.set(base, -1);
ReByteBuffer line;
+ int traceCount = 0;
while( (entry = traverser.rawNextFile(currentDepth))){
if (currentDepth <= level && ! entry->m_path.equals(current->m_path)){
if (currentDepth <= topOfStack){
} else {
current->m_sizes += entry->fileSize();
current->m_files++;
+ if (++traceCount % 100 == 0 && m_traceInterval > 0){
+ time_t now = time(NULL);
+ int diff = int(now - m_lastTrace);
+ if (diff >= m_traceInterval){
+ fprintf(stderr, "%s\n", current->m_path.str());
+ m_lastTrace = now;
+ }
+ }
}
}
// close all dirs with parents: