jfjoch_writer: Add index analysis time + refactor saving profiling information

This commit is contained in:
2026-04-28 19:45:38 +02:00
parent 81c9695c6b
commit 97a5899b73
14 changed files with 123 additions and 68 deletions
+54
View File
@@ -0,0 +1,54 @@
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "HDF5DataFilePluginPerformance.h"
void HDF5DataFilePluginPerformance::OpenFile(HDF5File &data_file, const DataMessage &msg, size_t images_per_file) {
indexing_time.reserve(images_per_file);
index_analysis_time.reserve(images_per_file);
spot_finding_time.reserve(images_per_file);
integration_time.reserve(images_per_file);
refinement_time.reserve(images_per_file);
processing_time.reserve(images_per_file);
bragg_prediction_time.reserve(images_per_file);
preprocessing_time.reserve(images_per_file);
compression_time.reserve(images_per_file);
azint_time.reserve(images_per_file);
}
void HDF5DataFilePluginPerformance::Write(const DataMessage &msg, uint64_t image_number) {
indexing_time[image_number] = msg.indexing_time_s.value_or(NAN);
spot_finding_time[image_number] = msg.spot_finding_time_s.value_or(NAN);
integration_time[image_number] = msg.integration_time_s.value_or(NAN);
refinement_time[image_number] = msg.refinement_time_s.value_or(NAN);
processing_time[image_number] = msg.processing_time_s.value_or(NAN);
bragg_prediction_time[image_number] = msg.bragg_prediction_time_s.value_or(NAN);
preprocessing_time[image_number] = msg.preprocessing_time_s.value_or(NAN);
compression_time[image_number] = msg.compression_time_s.value_or(NAN);
azint_time[image_number] = msg.azint_time_s.value_or(NAN);
}
void HDF5DataFilePluginPerformance::WriteFinal(HDF5File &data_file) {
HDF5Group(data_file, "/entry/profiling").NXClass("NXcollection");
if (!spot_finding_time.empty())
data_file.SaveVector("/entry/profiling/spotFindingTime", spot_finding_time.vec())->Units("s");
if (!indexing_time.empty())
data_file.SaveVector("/entry/profiling/indexingTime", indexing_time.vec())->Units("s");
if (!integration_time.empty())
data_file.SaveVector("/entry/profiling/integrationTime", integration_time.vec())->Units("s");
if (!refinement_time.empty())
data_file.SaveVector("/entry/profiling/refinementTime", refinement_time.vec())->Units("s");
if (!processing_time.empty())
data_file.SaveVector("/entry/profiling/processingTime", processing_time.vec())->Units("s");
if (!bragg_prediction_time.empty())
data_file.SaveVector("/entry/profiling/braggPredictionTime", bragg_prediction_time.vec())->Units("s");
if (!preprocessing_time.empty())
data_file.SaveVector("/entry/profiling/preprocessingTime", preprocessing_time.vec())->Units("s");
if (!compression_time.empty())
data_file.SaveVector("/entry/profiling/compressionTime", compression_time.vec())->Units("s");
if (!azint_time.empty())
data_file.SaveVector("/entry/profiling/azIntTime", azint_time.vec())->Units("s");
if (!index_analysis_time.empty())
data_file.SaveVector("/entry/profiling/indexAnalysisTime", index_analysis_time.vec())->Units("s");
}