diff --git a/receiver/JFJochReceiverPlots.cpp b/receiver/JFJochReceiverPlots.cpp index c3b5eafc..8132ea4e 100644 --- a/receiver/JFJochReceiverPlots.cpp +++ b/receiver/JFJochReceiverPlots.cpp @@ -109,7 +109,7 @@ void JFJochReceiverPlots::Setup(const DiffractionExperiment &experiment, const A refinement_time.Clear(r); spot_finding_time.Clear(r); integration_time.Clear(r); - processing_time.Clear(r); + total_processing_time.Clear(r); indexing_time.Clear(r); bragg_prediction_time.Clear(r); } @@ -135,7 +135,7 @@ void JFJochReceiverPlots::Add(const DataMessage &msg, const AzimuthalIntegration max_value.AddElement(msg.number, msg.max_viable_pixel_value); indexing_time.AddElement(msg.number, msg.indexing_time_s); - processing_time.AddElement(msg.number, msg.processing_time_s); + total_processing_time.AddElement(msg.number, msg.processing_time_s); spot_finding_time.AddElement(msg.number, msg.spot_finding_time_s); integration_time.AddElement(msg.number, msg.integration_time_s); refinement_time.AddElement(msg.number, msg.refinement_time_s); @@ -360,7 +360,7 @@ MultiLinePlot JFJochReceiverPlots::GetPlots(const PlotRequest &request) { bragg_prediction.title = "bragg prediction"; ret.AddPlot(bragg_prediction); - auto total = processing_time.GetMeanPerBin(nbins, start, incr, request.fill_value); + auto total = total_processing_time.GetMeanPerBin(nbins, start, incr, request.fill_value); total.title = "total"; ret.AddPlot(total); @@ -401,6 +401,17 @@ std::optional JFJochReceiverPlots::GetBkgEstimate() const { return {}; } +MeanProcessingTime JFJochReceiverPlots::GetMeanProcessingTime() const { + MeanProcessingTime ret{}; + ret.spot_finding = spot_finding_time.Mean(); + ret.indexing = indexing_time.Mean(); + ret.integration = integration_time.Mean(); + ret.refinement = refinement_time.Mean(); + ret.bragg_prediction = bragg_prediction_time.Mean(); + ret.processing = total_processing_time.Mean(); + return ret; +} + void JFJochReceiverPlots::GetXFELPulseID(std::vector &v) const { std::unique_lock ul(m); v = xfel_pulse_id.vec(); @@ -534,7 +545,7 @@ void JFJochReceiverPlots::GetPlotRaw(std::vector &v, PlotType type, const v = pixel_sum.ExportArray(); break; case PlotType::ImageProcessingTime: - v = processing_time.ExportArray(); + v = total_processing_time.ExportArray(); break; case PlotType::RefinementBeamX: v = beam_center_x.ExportArray(); diff --git a/receiver/JFJochReceiverPlots.h b/receiver/JFJochReceiverPlots.h index 2075f7c7..9985a10f 100644 --- a/receiver/JFJochReceiverPlots.h +++ b/receiver/JFJochReceiverPlots.h @@ -18,6 +18,15 @@ #include "../common/Plot.h" #include "../common/ScanResult.h" +struct MeanProcessingTime { + float spot_finding; + float indexing; + float refinement; + float integration; + float bragg_prediction; + float processing; +}; + class JFJochReceiverPlots { mutable std::mutex m; // protects xfel_pulse_id, xfel_event_code and az_int_profile @@ -77,7 +86,7 @@ class JFJochReceiverPlots { StatusVector refinement_time; StatusVector integration_time; StatusVector bragg_prediction_time; - StatusVector processing_time; + StatusVector total_processing_time; MultiLinePlot GetROIPlot(PlotType type, int64_t nbins, float start, float incr, const std::optional &fill_value) const; @@ -97,6 +106,8 @@ public: std::vector GetAzIntProfile() const; MultiLinePlot GetAzIntProfilePlot(bool force_1d = false, PlotAzintUnit azint_unit = PlotAzintUnit::Q_recipA) const; + MeanProcessingTime GetMeanProcessingTime() const; + void GetPlotRaw(std::vector &v, PlotType type, const std::string &roi); }; diff --git a/tools/jfjoch_process.cpp b/tools/jfjoch_process.cpp index f60695ca..0b1a14b9 100644 --- a/tools/jfjoch_process.cpp +++ b/tools/jfjoch_process.cpp @@ -725,6 +725,16 @@ int main(int argc, char **argv) { if (!end_msg.indexing_rate.has_value()) { logger.Info("Indexing rate: {:.2f}%", end_msg.indexing_rate.value() * 100.0); } + + auto image_mean_time = plots.GetMeanProcessingTime(); + logger.Info("Per-image time: (mean; microseconds): spot finding {:.0f} indexing {:.0f} refinement {:.0f} prediction {:.0f} integration {:.0f} total {:.0f}", + image_mean_time.spot_finding * 1e6, + image_mean_time.indexing * 1e6, + image_mean_time.refinement * 1e6, + image_mean_time.bragg_prediction * 1e6, + image_mean_time.integration * 1e6, + image_mean_time.processing * 1e6); + if (rotation_indexer_ret.has_value()) { auto latt = rotation_indexer_ret->lattice; if (auto axis_ = experiment.GetGoniometer()) {