added lock

This commit is contained in:
Jared Bruni
2021-08-28 13:35:43 -07:00
parent e08cbbb510
commit 0364b01234
3 changed files with 10 additions and 2 deletions

View File

@@ -1431,14 +1431,14 @@ void AC_MainWindow::updateFrame(QImage img) {
if(!recording) { if(!recording) {
frame_stream << "(Current/Total Frames/Seconds) - (" << frame_index << "/" << video_frames << "/" << (unsigned long)(frame_index/video_fps) << ") - "; frame_stream << "(Current/Total Frames/Seconds) - (" << frame_index << "/" << video_frames << "/" << (unsigned long)(frame_index/video_fps) << ") - ";
unsigned long mem = ac::calculateMemory(); unsigned long mem = playback->calcMem();
frame_stream << "Memory Allocated: " << ((mem > 0) ? (mem/1024/1024) : 0) << " MB - " << " Initalized: " << ac::all_objects.size() << " - Allocated: " << ac::getCurrentAllocatedFrames() << "\n"; frame_stream << "Memory Allocated: " << ((mem > 0) ? (mem/1024/1024) : 0) << " MB - " << " Initalized: " << ac::all_objects.size() << " - Allocated: " << ac::getCurrentAllocatedFrames() << "\n";
} else { } else {
struct stat buf; struct stat buf;
stat(video_file_name.toStdString().c_str(), &buf); stat(video_file_name.toStdString().c_str(), &buf);
frame_stream << "(Current/Total Frames/Seconds/Size) - (" << frame_index << "/" << video_frames << "/" << (unsigned int)(frame_index/video_fps) << "/" << ((buf.st_size/1000)/1000) << " MB) - "; frame_stream << "(Current/Total Frames/Seconds/Size) - (" << frame_index << "/" << video_frames << "/" << (unsigned int)(frame_index/video_fps) << "/" << ((buf.st_size/1000)/1000) << " MB) - ";
unsigned long mem = ac::calculateMemory(); unsigned long mem = playback->calcMem();
frame_stream << "Memory Allocated: " << ((mem > 0) ? (mem/1024/1024) : 0) << " MB - " << "Initalized: " << ac::all_objects.size() << " - Allocated: " << ac::getCurrentAllocatedFrames() << "\n"; frame_stream << "Memory Allocated: " << ((mem > 0) ? (mem/1024/1024) : 0) << " MB - " << "Initalized: " << ac::all_objects.size() << " - Allocated: " << ac::getCurrentAllocatedFrames() << "\n";
} }
if(programMode == MODE_VIDEO) { if(programMode == MODE_VIDEO) {

View File

@@ -119,6 +119,13 @@ void Playback::setVector(std::vector<FilterValue> v) {
mutex_add.unlock(); mutex_add.unlock();
} }
unsigned long Playback::calcMem() {
mutex.lock();
unsigned long calc = ac::calculateMemory();
mutex.unlock();
return calc;
}
void Playback::setOptions(bool n, int c) { void Playback::setOptions(bool n, int c) {
mutex.lock(); mutex.lock();
ac::isNegative = n; ac::isNegative = n;

View File

@@ -89,6 +89,7 @@ public:
void setCycle(int type, int frame_skip, std::vector<std::string> &val); void setCycle(int type, int frame_skip, std::vector<std::string> &val);
void setCycle(int type); void setCycle(int type);
void setPref(int thread_count, int intense); void setPref(int thread_count, int intense);
unsigned long calcMem();
void setCustomCycle(bool b); void setCustomCycle(bool b);
void setCustomCycleDelay(int delay); void setCustomCycleDelay(int delay);
signals: signals: