bb9f5c715f
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m55s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 10m28s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 11m47s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m7s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m31s
Build Packages / build:rpm (rocky8) (push) Successful in 12m59s
Build Packages / build:rpm (rocky9) (push) Successful in 14m5s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 15m30s
Build Packages / Generate python client (push) Successful in 1m18s
Build Packages / Build documentation (push) Successful in 1m3s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (ubuntu2404) (push) Successful in 10m8s
Build Packages / XDS test (durin plugin) (push) Successful in 9m16s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m59s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m12s
Build Packages / DIALS test (push) Successful in 11m44s
Build Packages / Unit tests (push) Successful in 1h23m8s
This is an UNSTABLE release. The release has significant modifications and bug fixes, if things go wrong, it is better to revert to 1.0.0-rc.132. * Multiple small bug fixes scattered across the whole code base. (detected with GPT-5.4) * jfjoch_viewer: Improve image render performance Reviewed-on: #44 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch> Co-committed-by: Filip Leonarski <filip.leonarski@psi.ch>
73 lines
2.5 KiB
C++
73 lines
2.5 KiB
C++
// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#ifndef JUNGFRAUJOCH_ACQUISITIONCOUNTERS_H
|
|
#define JUNGFRAUJOCH_ACQUISITIONCOUNTERS_H
|
|
|
|
#include <condition_variable>
|
|
#include <shared_mutex>
|
|
#include <vector>
|
|
|
|
#include "../common/DiffractionExperiment.h"
|
|
#include "../common/Definitions.h"
|
|
#include "Completion.h"
|
|
|
|
// AcquisitionCounters are used for information that needs to be accessed during data collection,
|
|
// so uses mutex to ensure consistency
|
|
|
|
class AcquisitionCounters {
|
|
uint32_t expected_packets_per_module;
|
|
constexpr static const uint64_t max_modules = 32;
|
|
mutable std::shared_mutex m;
|
|
mutable std::condition_variable_any data_updated;
|
|
|
|
std::vector<uint64_t> handle_for_frame;
|
|
std::vector<uint16_t> packets_collected;
|
|
|
|
uint64_t total_packets;
|
|
std::vector<uint64_t> packets_per_module;
|
|
|
|
uint64_t slowest_frame_number;
|
|
uint64_t fastest_frame_number;
|
|
std::vector<uint64_t> curr_frame_number;
|
|
bool acquisition_finished;
|
|
uint64_t expected_frames;
|
|
uint64_t nmodules = max_modules;
|
|
uint64_t bytes_per_packet;
|
|
|
|
public:
|
|
static constexpr const uint64_t HandleNotFound = UINT64_MAX;
|
|
constexpr static const uint64_t ThresholdFramesLost = 50;
|
|
AcquisitionCounters();
|
|
|
|
void Reset(const DiffractionExperiment &experiment, uint16_t data_stream);
|
|
void UpdateCounters(const Completion *c);
|
|
void SetAcquisitionFinished();
|
|
|
|
uint64_t GetBufferHandleAndClear(size_t frame, uint16_t module_number);
|
|
|
|
uint64_t GetCurrFrameNumber(uint16_t module_number) const;
|
|
uint64_t GetSlowestFrameNumber() const;
|
|
uint64_t GetFastestFrameNumber() const;
|
|
|
|
void WaitForFrame(size_t curr_frame, uint16_t module_number = UINT16_MAX) const;
|
|
int64_t CalculateDelay(size_t curr_frame, uint16_t module_number = UINT16_MAX) const; // mutex acquired indirectly
|
|
uint64_t GetBufferHandle(size_t frame, uint16_t module_number) const;
|
|
bool IsFullModuleCollected(size_t frame, uint16_t module_number) const;
|
|
bool IsAnyPacketCollected(size_t frame, uint16_t module_number) const;
|
|
bool IsAcquisitionFinished() const;
|
|
|
|
uint64_t GetTotalPackets() const;
|
|
uint64_t GetTotalPackets(uint16_t module_number) const;
|
|
uint64_t GetBytesReceived() const;
|
|
|
|
uint64_t GetTotalExpectedPackets() const;
|
|
uint64_t GetTotalExpectedPacketsPerModule() const;
|
|
uint64_t GetExpectedPacketsPerImage() const;
|
|
|
|
uint64_t GetModuleNumber() const;
|
|
};
|
|
|
|
|
|
#endif //JUNGFRAUJOCH_ACQUISITIONCOUNTERS_H
|