HDF5 file writer - per file analysis
This commit is contained in:
+8
-17
@@ -26,7 +26,7 @@ void StreamWriter::StartDataCollection() {
|
||||
MakeDirectory(start_message.file_prefix);
|
||||
}
|
||||
|
||||
void StreamWriter::CollectImages() {
|
||||
void StreamWriter::CollectImages(std::vector<HDF5DataFileStatistics> &v) {
|
||||
HDF5Writer writer(start_message);
|
||||
image_puller.WaitForImage();
|
||||
while (image_puller.GetFrameType() == JFJochFrameDeserializer::Type::IMAGE) {
|
||||
@@ -34,6 +34,7 @@ void StreamWriter::CollectImages() {
|
||||
writer.Write(image_array);
|
||||
image_puller.WaitForImage();
|
||||
}
|
||||
writer.GetStatistics(v);
|
||||
}
|
||||
|
||||
void StreamWriter::EndDataCollection() {
|
||||
@@ -51,10 +52,11 @@ void StreamWriter::Abort() {
|
||||
image_puller.Abort();
|
||||
}
|
||||
|
||||
ZMQImagePullerStatistics StreamWriter::Run() {
|
||||
StreamWriterStatistics StreamWriter::Run() {
|
||||
StreamWriterStatistics ret;
|
||||
StartDataCollection();
|
||||
try {
|
||||
CollectImages();
|
||||
CollectImages(ret.data_file_stats);
|
||||
} catch (JFJochException &e) {
|
||||
// Error during collecting images will skip to end data collection
|
||||
// End data collection will consume all images till the end
|
||||
@@ -62,19 +64,8 @@ ZMQImagePullerStatistics StreamWriter::Run() {
|
||||
}
|
||||
EndDataCollection();
|
||||
|
||||
auto puller_stats = image_puller.GetStatistics();
|
||||
ret.image_puller_stats = image_puller.GetStatistics();
|
||||
logger.Info("Write task done. Images = {} Throughput = {:.0f} MB/s Frame rate = {:.0f} Hz",
|
||||
puller_stats.processed_images, puller_stats.performance_MBs, puller_stats.performance_Hz);
|
||||
return puller_stats;
|
||||
ret.image_puller_stats.processed_images, ret.image_puller_stats.performance_MBs, ret.image_puller_stats.performance_Hz);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void StreamWriter::BaseDirectory(const std::string &input) {
|
||||
logger.Info("Setting base directory to " + input);
|
||||
try {
|
||||
std::filesystem::current_path(input);
|
||||
} catch (const std::filesystem::filesystem_error& err) {
|
||||
logger.Error("Cannot set base directory: " + std::string(err.what()));
|
||||
throw JFJochException(JFJochExceptionCategory::FileWriteError,
|
||||
"Cannot set base directory " + std::string(err.what()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user