ngscopeclient v0.1.1
Session.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
4* *
5* Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
35#ifndef Session_h
36#define Session_h
37
38class MainWindow;
39class WaveformArea;
41
42#include "../xptools/HzClock.h"
43#include "HistoryManager.h"
44#include "PacketManager.h"
45#include "PreferenceManager.h"
46#include "Marker.h"
47#include "TriggerGroup.h"
48
49extern std::atomic<int64_t> g_lastWaveformRenderTime;
50
51class Session;
52
54{
55public:
57 {
58 m_shuttingDown = false;
59 args.shuttingDown = &m_shuttingDown;
60 m_thread = std::make_unique<std::thread>(InstrumentThread, args);
62 }
63
65 { Close(); }
66
67 void Close()
68 {
69 if(m_thread)
70 {
71 //Terminate the thread
72 m_shuttingDown = true;
73 m_thread->join();
74 }
75 m_thread = nullptr;
76 }
77
79 std::atomic<bool> m_shuttingDown;
80
82 std::unique_ptr<std::thread> m_thread;
83
86};
87
95{
96public:
97 Session(MainWindow* wnd);
98 virtual ~Session();
99
100 bool OnMemoryPressure(MemoryPressureLevel level, MemoryPressureType type, size_t requestedSize);
101
102 void ArmTrigger(TriggerGroup::TriggerType type, bool all=false);
103 void StopTrigger(bool all=false);
104 bool HasOnlineScopes();
105 void DownloadWaveforms();
106 bool CheckForWaveforms(vk::raii::CommandBuffer& cmdbuf);
107 void RefreshAllFilters();
110 bool RefreshDirtyFilters();
111 void FlushConfigCache();
112
114
115 void RenderWaveformTextures(
116 vk::raii::CommandBuffer& cmdbuf,
117 std::vector<std::shared_ptr<DisplayedChannel> >& channels);
118
119 void Clear();
121
122 bool PreLoadFromYaml(const YAML::Node& node, const std::string& dataDir, bool online);
123 bool LoadFromYaml(const YAML::Node& node, const std::string& dataDir, bool online);
125 YAML::Node SerializeMetadata();
126 YAML::Node SerializeTriggerGroups();
127 bool LoadTriggerGroups(const YAML::Node& node);
128 YAML::Node SerializeFilterConfiguration();
129 YAML::Node SerializeMarkers();
130 bool SerializeWaveforms(const std::string& dataDir);
131 bool SerializeSparseWaveform(SparseWaveformBase* wfm, const std::string& path);
132 bool SerializeUniformWaveform(UniformWaveformBase* wfm, const std::string& path);
133
134 void AddMultimeterDialog(std::shared_ptr<SCPIMultimeter> meter);
135 std::shared_ptr<PacketManager> AddPacketFilter(PacketDecoder* filter);
136
137 void AddInstrument(std::shared_ptr<Instrument> inst, bool createDialogs = true);
138 void RemoveInstrument(std::shared_ptr<Instrument> inst);
139 std::shared_ptr<InstrumentConnectionState> GetInstrumentConnectionState(std::shared_ptr<Instrument> inst) { return m_instrumentStates[inst]; }
140
141 bool IsMultiScope()
142 { return m_multiScope; }
143
144 MainWindow* GetMainWindow()
145 { return m_mainWindow; }
146
150 std::shared_ptr<BERTState> GetBERTState(std::shared_ptr<BERT> bert)
151 {
152 std::lock_guard<std::mutex> lock(m_scopeMutex);
153 return m_berts[bert];
154 }
155
159 std::shared_ptr<PowerSupplyState> GetPSUState(std::shared_ptr<SCPIPowerSupply> psu)
160 {
161 std::lock_guard<std::mutex> lock(m_scopeMutex);
162 return m_psus[psu];
163 }
164
168 std::shared_ptr<FunctionGeneratorState> GetFunctionGeneratorState(std::shared_ptr<FunctionGenerator> awg)
169 {
170 std::lock_guard<std::mutex> lock(m_scopeMutex);
171 return m_awgs[awg];
172 }
173
177 std::shared_ptr<PacketManager> GetPacketManager(PacketDecoder* filter)
178 {
179 std::lock_guard<std::mutex> lock(m_packetMgrMutex);
180
181 auto it = m_packetmgrs.find(filter);
182 if(it != m_packetmgrs.end())
183 return it->second;
184
185 else
186 {
187 LogWarning(
188 "No packet manager found for filter %s (this should never happen). "
189 "Creating a new one to avoid crashing\n",
190 filter->GetDisplayName().c_str());
191
192 auto ret = std::make_shared<PacketManager>(filter, *this);
193 m_packetmgrs[filter] = ret;
194 return ret;
195 }
196 }
197
198 void ApplyPreferences(std::shared_ptr<Oscilloscope> scope);
199
200 size_t GetFilterCount();
201
202 bool IsChannelBeingDragged();
203
204 int64_t GetToneMapTime();
205
210 { return m_lastFilterGraphExecTime.load(); }
211
216 { return g_lastWaveformRenderTime.load(); }
217
222 {
223 std::lock_guard<std::mutex> lock(m_perfClockMutex);
224 return m_waveformDownloadRate.GetAverageHz();
225 }
226
230 const std::vector<std::shared_ptr<Oscilloscope>> GetScopes()
231 {
232 std::lock_guard<std::mutex> lock(m_scopeMutex);
233 return m_oscilloscopes;
234 }
235
239 const std::vector<std::shared_ptr<BERT> > GetBERTs()
240 {
241 std::lock_guard<std::mutex> lock(m_scopeMutex);
242 std::vector<std::shared_ptr<BERT> > berts;
243 for(auto& it : m_berts)
244 berts.push_back(it.first);
245 return berts;
246 }
247
251 std::set<std::shared_ptr<SCPIInstrument>> GetSCPIInstruments();
252
256 std::set<std::shared_ptr<Instrument>> GetInstruments();
257
262 { return GetInstruments().size(); }
263
268
272 std::shared_mutex& GetWaveformDataMutex()
273 { return m_waveformDataMutex; }
274
279 { return m_history; }
280
284 void AddMarker(Marker m);
285
287
288 void ClearSweeps();
289
294 { return m_rasterizedWaveformMutex; }
295
300
304 std::string m_generalNotes;
305
309 std::string m_setupNotes;
310
311 std::vector<std::shared_ptr<TriggerGroup> > GetTriggerGroups()
312 {
313 std::lock_guard<std::recursive_mutex> lock(m_triggerGroupMutex);
314 return m_triggerGroups;
315 }
316
318
319 void MakeNewTriggerGroup(std::shared_ptr<Oscilloscope> scope);
320 void MakeNewTriggerGroup(PausableFilter* filter);
321
322 int64_t GetDeskew(std::shared_ptr<Oscilloscope> scope)
323 { return m_scopeDeskewCal[scope]; }
324
325 void SetDeskew(std::shared_ptr<Oscilloscope> scope, int64_t skew)
326 { m_scopeDeskewCal[scope] = skew; }
327
328 bool IsPrimaryOfMultiScopeGroup(std::shared_ptr<Oscilloscope> scope);
329 bool IsSecondaryOfMultiScopeGroup(std::shared_ptr<Oscilloscope> scope);
330
331 std::shared_ptr<TriggerGroup> GetTriggerGroupForScope(std::shared_ptr<Oscilloscope> scope);
332 std::shared_ptr<TriggerGroup> GetTriggerGroupForFilter(PausableFilter* filter);
333
334 const ConfigWarningList& GetWarnings()
335 { return m_warnings; }
336
338 std::shared_ptr<LoadState> GetLoadState(std::shared_ptr<Load> load)
339 {
340 auto it = m_loads.find(load);
341 if(it != m_loads.end())
342 return it->second;
343 else
344 return nullptr;
345 }
346
347 std::shared_ptr<TriggerGroup> GetTrendFilterGroup();
348
349 void OnMarkerChanged();
350
352 std::map<FlowGraphNode*, int64_t> GetFilterGraphRuntime()
353 {
354 std::lock_guard<std::mutex> lock(m_lastFilterGraphRuntimeMutex);
356 }
357
358protected:
359 void UpdatePacketManagers(const std::set<FlowGraphNode*>& nodes, bool nodesListIsComplete);
360
361 std::string GetRegisteredTypeOfDriver(const std::string& drivername);
362
363 bool LoadInstruments(int version, const YAML::Node& node, bool online);
364 bool PreLoadInstruments(int version, const YAML::Node& node, bool online);
365 SCPITransport* CreateTransportForNode(const YAML::Node& node);
366 bool VerifyInstrument(const YAML::Node& node, std::shared_ptr<Instrument> inst);
367 bool PreLoadVNA(int version, const YAML::Node& node, bool online);
368 bool PreLoadOscilloscope(int version, const YAML::Node& node, bool online);
369 bool PreLoadPowerSupply(int version, const YAML::Node& node, bool online);
370 bool PreLoadRFSignalGenerator(int version, const YAML::Node& node, bool online);
371 bool PreLoadFunctionGenerator(int version, const YAML::Node& node, bool online);
372 bool PreLoadMultimeter(int version, const YAML::Node& node, bool online);
373 bool PreLoadSpectrometer(int version, const YAML::Node& node, bool online);
374 bool PreLoadSDR(int version, const YAML::Node& node, bool online);
375 bool PreLoadBERT(int version, const YAML::Node& node, bool online);
376 bool PreLoadLoad(int version, const YAML::Node& node, bool online);
377 bool PreLoadMisc(int version, const YAML::Node& node, bool online);
378 bool LoadFilters(int version, const YAML::Node& node);
379 bool LoadInstrumentInputs(int version, const YAML::Node& node);
380 bool LoadWaveformData(int version, const std::string& dataDir);
382 int version,
383 const YAML::Node& node,
384 std::shared_ptr<Oscilloscope> scope,
385 const std::string& dataDir);
387 int version,
388 const YAML::Node& node,
389 const std::string& dataDir);
390 void DoLoadWaveformDataForStream(
392 int stream,
393 std::string format,
394 std::string fname);
395
398
401
403 std::map<std::shared_ptr<Oscilloscope>, int64_t> m_scopeDeskewCal;
404
406 std::mutex m_scopeMutex;
407
409 std::shared_mutex m_waveformDataMutex;
410
413
416
418 std::atomic<bool> m_shuttingDown;
419
422
424 std::vector<std::shared_ptr<Oscilloscope>> m_oscilloscopes;
425
427 std::map<std::shared_ptr<PowerSupply>, std::shared_ptr<PowerSupplyState> > m_psus;
428
430 std::map<std::shared_ptr<Multimeter>, std::shared_ptr<MultimeterState> > m_meters;
431
433 std::map<std::shared_ptr<Load>, std::shared_ptr<LoadState> > m_loads;
434
436 std::map<std::shared_ptr<BERT>, std::shared_ptr<BERTState> > m_berts;
437
439 std::map<std::shared_ptr<FunctionGenerator>, std::shared_ptr<FunctionGeneratorState> > m_awgs;
440
442 std::vector<std::shared_ptr<TriggerGroup> > m_triggerGroups;
443
445 std::shared_ptr<TriggerGroup> m_trendTriggerGroup;
446
448 std::recursive_mutex m_triggerGroupMutex;
449
451 std::map<std::shared_ptr<Instrument>, std::shared_ptr<InstrumentConnectionState> > m_instrumentStates;
452
454 std::unique_ptr<std::thread> m_waveformThread;
455
457 std::set<std::shared_ptr<Oscilloscope> > m_recentlyTriggeredScopes;
458
460 std::set<std::shared_ptr<TriggerGroup>> m_recentlyTriggeredGroups;
461
464
466 double m_tArm;
467
470
473
476
479
481 std::atomic<int64_t> m_lastFilterGraphExecTime;
482
485
487 std::map<FlowGraphNode*, int64_t> m_lastFilterGraphRuntimeStats;
488
491
494
497
500
502 std::map<PacketDecoder*, std::shared_ptr<PacketManager> > m_packetmgrs;
503
506
509
511 // Markers
512
514 std::map<TimePoint, std::vector<Marker> > m_markers;
515
518
520 // Partial graph refreshes
521
523 std::set<FlowGraphNode*> m_dirtyChannels;
524
527
528public:
529
533 std::string GetNextMarkerName()
534 { return std::string("M") + std::to_string(m_nextMarkerNum ++); }
535
539 std::vector<Marker>& GetMarkers(TimePoint t)
540 { return m_markers[t]; }
541
545 std::vector<TimePoint> GetMarkerTimes();
546
551 { m_markers.erase(t); }
552
553 void RemovePackets(TimePoint t);
554
555 std::set<FlowGraphNode*> GetAllGraphNodes();
556
558 std::optional<TimePoint> GetHoveredPacketTimestamp()
559 { return m_hoverTime; }
560
561 void SetHoveredPacketTimestamp(std::optional<TimePoint> t)
562 { m_hoverTime = t; }
563
564protected:
565 std::optional<TimePoint> m_hoverTime;
566
568 // End user preferences (persistent across sessions)
569
570 //Preferences state
571 PreferenceManager m_preferences;
572
573public:
574 PreferenceManager& GetPreferences()
575 { return m_preferences; }
576
578 // Reference filters (used to query legal inputs to filters etc)
579
580public:
581
585 Filter* GetReferenceFilter(const std::string& name)
586 { return m_referenceFilters[name]; }
587
588 const std::map<std::string, Filter*>& GetReferenceFilters()
589 { return m_referenceFilters; }
590
592 const std::vector<std::string>& GetDriverNamesForType(const std::string& type)
593 { return m_driverNamesByType[type]; }
594
596 const std::string& driver,
597 SCPITransport* transport,
598 const std::string& nickname);
599
600protected:
603
604 std::map<std::string, Filter*> m_referenceFilters;
605
607 std::map<std::string, std::vector<std::string> > m_driverNamesByType;
608};
609
610#endif
MemoryPressureLevel
Levels of memory pressure.
Definition: AcceleratorBuffer.h:67
MemoryPressureType
Types of memory pressure.
Definition: AcceleratorBuffer.h:84
Declaration of HistoryManager.
Declaration of Marker.
Declaration of PacketManager.
Stores and manages preference values.
std::atomic< int64_t > g_lastWaveformRenderTime
Time spent on the last cycle of waveform rendering shaders.
Definition: WaveformThread.cpp:53
Declaration of TriggerGroup.
All warnings generated by a configuration we're in the process of loading.
Definition: ConfigWarningList.h:90
Context data for a single channel being displayed within a WaveformArea.
Definition: WaveformArea.h:190
Execution manager / scheduler for the filter graph.
Definition: FilterGraphExecutor.h:48
Abstract base class for all filter graph blocks which are not physical instrument channels.
Definition: Filter.h:95
Keeps track of recently acquired waveforms.
Definition: HistoryManager.h:73
Clock that measures rate at which it is called; windowed average.
Definition: HzClock.h:52
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition: IDTable.h:51
A single channel of an instrument.
Definition: InstrumentChannel.h:63
Definition: Session.h:54
std::unique_ptr< std::thread > m_thread
Thread for polling the instrument.
Definition: Session.h:82
Oscilloscope::TriggerMode m_lastTriggerState
Cached trigger state, to reflect in the UI.
Definition: Session.h:85
std::atomic< bool > m_shuttingDown
Termination flag for shutting down the polling thread.
Definition: Session.h:79
Definition: ngscopeclient.h:58
Top level application window.
Definition: MainWindow.h:115
Data for a marker.
Definition: Marker.h:85
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
virtual std::string GetDisplayName() override
Gets the human-readable nickname for this channel, as displayed in the GUI.
Definition: OscilloscopeChannel.cpp:261
TriggerMode
Definition: Oscilloscope.h:396
@ TRIGGER_MODE_WAIT
WAIT - not yet fully armed.
Definition: Oscilloscope.h:407
Definition: PacketDecoder.h:85
A filter which may be started and stopped.
Definition: PausableFilter.h:46
Definition: PreferenceManager.h:45
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
A Session stores all of the instrument configuration and other state the user has open.
Definition: Session.h:95
std::map< std::shared_ptr< BERT >, std::shared_ptr< BERTState > > m_berts
BERTs we are currently connected to.
Definition: Session.h:436
bool PreLoadFromYaml(const YAML::Node &node, const std::string &dataDir, bool online)
Perform partial loading and check for potentially dangerous configurations.
Definition: Session.cpp:322
int64_t GetToneMapTime()
Gets the last execution time of the tone mapping shaders.
Definition: Session.cpp:3505
std::shared_ptr< LoadState > GetLoadState(std::shared_ptr< Load > load)
Get the state for a load.
Definition: Session.h:338
const std::vector< std::string > & GetDriverNamesForType(const std::string &type)
Get all of the drivers of a given type.
Definition: Session.h:592
void RemoveMarkers(TimePoint t)
Deletes markers for a waveform timestamp.
Definition: Session.h:550
void CreateAndAddInstrument(const std::string &driver, SCPITransport *transport, const std::string &nickname)
Creates a new instrument and adds it to the session.
Definition: Session.cpp:2799
std::map< PacketDecoder *, std::shared_ptr< PacketManager > > m_packetmgrs
Historical packet data from filters.
Definition: Session.h:502
double m_tArm
Time we last armed the global trigger.
Definition: Session.h:466
std::unique_ptr< std::thread > m_waveformThread
Processing thread for waveform data.
Definition: Session.h:454
std::string GetNextMarkerName()
Generate an automatic name for a newly created marker.
Definition: Session.h:533
std::mutex m_recentlyTriggeredScopeMutex
Mutex to synchronize access to m_recentlyTriggeredScopes.
Definition: Session.h:463
std::vector< std::shared_ptr< TriggerGroup > > m_triggerGroups
Trigger groups for syncing oscilloscopes.
Definition: Session.h:442
std::map< std::shared_ptr< FunctionGenerator >, std::shared_ptr< FunctionGeneratorState > > m_awgs
Function generator we are currently connected to.
Definition: Session.h:439
bool HasOnlineScopes()
Returns true if we have at least one scope that isn't offline.
Definition: Session.cpp:3150
int64_t GetFilterGraphExecTime()
Gets the last execution time of the filter graph.
Definition: Session.h:209
std::shared_ptr< FunctionGeneratorState > GetFunctionGeneratorState(std::shared_ptr< FunctionGenerator > awg)
Returns a pointer to the state for a function generator.
Definition: Session.h:168
bool SerializeSparseWaveform(SparseWaveformBase *wfm, const std::string &path)
Saves waveform sample data in the "sparsev1" file format.
Definition: Session.cpp:2438
bool LoadFromYaml(const YAML::Node &node, const std::string &dataDir, bool online)
Deserialize a YAML::Node (and associated data directory) to the current session.
Definition: Session.cpp:355
HistoryManager & GetHistory()
Get our history manager.
Definition: Session.h:278
ConfigWarningList m_warnings
Warnings generated by loading the current file.
Definition: Session.h:400
void StartWaveformThreadIfNeeded()
Starts the WaveformThread if we don't already have one.
Definition: Session.cpp:2790
HzClock m_waveformDownloadRate
Frequency at which we are pulling waveforms off of scopes.
Definition: Session.h:493
void RefreshAllFiltersNonblocking()
Queues a request to refresh all filters the next time we poll stuff.
Definition: Session.cpp:3291
std::shared_ptr< PacketManager > AddPacketFilter(PacketDecoder *filter)
Called when a new packet filter is created.
Definition: Session.cpp:3480
std::recursive_mutex m_triggerGroupMutex
Mutex controlling access to m_triggerGroups.
Definition: Session.h:448
void Clear()
Clears all session state and returns the object to an empty state.
Definition: Session.cpp:174
void RefreshDirtyFiltersNonblocking()
Queues a request to refresh dirty filters the next time we poll stuff.
Definition: Session.cpp:3301
std::shared_ptr< PowerSupplyState > GetPSUState(std::shared_ptr< SCPIPowerSupply > psu)
Returns a pointer to the state for a power supply.
Definition: Session.h:159
std::optional< TimePoint > GetHoveredPacketTimestamp()
Returns the timestamp of the protocol analyzer event that the mouse is over, if any.
Definition: Session.h:558
void AddInstrument(std::shared_ptr< Instrument > inst, bool createDialogs=true)
Adds a new instrument to the session.
Definition: Session.cpp:2871
bool LoadWaveformDataForFilters(int version, const YAML::Node &node, const std::string &dataDir)
Loads waveform data for filters that need to be preserved.
Definition: Session.cpp:449
std::shared_ptr< PacketManager > GetPacketManager(PacketDecoder *filter)
Returns a pointer to the existing packet manager for a protocol decode filter.
Definition: Session.h:177
std::vector< std::shared_ptr< Oscilloscope > > m_oscilloscopes
Oscilloscopes we are currently connected to.
Definition: Session.h:424
std::mutex m_lastFilterGraphRuntimeMutex
Mutex for controlling access to m_lastFilterGraphRuntimeStats.
Definition: Session.h:484
void AddMarker(Marker m)
Adds a marker.
Definition: Session.cpp:273
std::set< std::shared_ptr< Instrument > > GetInstruments()
Gets the set of all instruments we're connect to (regardless of type)
Definition: Session.cpp:3056
std::mutex m_dirtyChannelsMutex
Mutex controlling access to m_dirtyChannels.
Definition: Session.h:526
bool m_multiScope
True if we have >1 oscilloscope.
Definition: Session.h:508
FilterGraphExecutor m_graphExecutor
Context for filter graph evaluation.
Definition: Session.h:478
bool SerializeUniformWaveform(UniformWaveformBase *wfm, const std::string &path)
Saves waveform sample data in the "densev1" file format.
Definition: Session.cpp:2576
std::map< FlowGraphNode *, int64_t > GetFilterGraphRuntime()
Return the last filter graph runtime stats.
Definition: Session.h:352
bool CheckForPendingWaveforms()
Check if we have data available from all of our scopes.
Definition: Session.cpp:3160
void StopTrigger(bool all=false)
Stop the trigger for the session.
Definition: Session.cpp:3134
std::atomic< int64_t > m_lastFilterGraphExecTime
Time spent on the last filter graph execution.
Definition: Session.h:481
YAML::Node SerializeInstrumentConfiguration()
Serialize the configuration for all oscilloscopes.
Definition: Session.cpp:2083
std::shared_mutex & GetWaveformDataMutex()
Get the mutex controlling access to waveform data.
Definition: Session.h:272
void GarbageCollectTriggerGroups()
Remove trigger groups with no instruments in them.
Definition: Session.cpp:2636
std::vector< TimePoint > GetMarkerTimes()
Get a list of timestamps for markers.
Definition: Session.cpp:264
std::set< std::shared_ptr< SCPIInstrument > > GetSCPIInstruments()
Gets the set of all SCPI instruments we're connect to (regardless of type)
Definition: Session.cpp:3006
YAML::Node SerializeFilterConfiguration()
Serialize the configuration for all protocol decoders.
Definition: Session.cpp:2106
bool m_triggerArmed
Indicates trigger is armed (incoming waveforms are ignored if not armed)
Definition: Session.h:472
std::atomic< bool > m_shuttingDown
Flag for shutting down all scope threads when we exit.
Definition: Session.h:418
void ClearBackgroundThreads()
Terminate all background threads for instruments.
Definition: Session.cpp:126
MainWindow * m_mainWindow
Top level UI window.
Definition: Session.h:415
std::set< FlowGraphNode * > m_dirtyChannels
Set of dirty channels.
Definition: Session.h:523
std::vector< Marker > & GetMarkers(TimePoint t)
Get the markers for a given waveform timestamp.
Definition: Session.h:539
void RemoveInstrument(std::shared_ptr< Instrument > inst)
Removes an instrument from the session.
Definition: Session.cpp:2967
void OnMarkerChanged()
Called when a marker is added, removed, or modified.
Definition: Session.cpp:297
std::map< std::shared_ptr< Oscilloscope >, int64_t > m_scopeDeskewCal
Deskew correction coefficients for multi-scope.
Definition: Session.h:403
std::string m_setupNotes
Session notes about the experimental setup.
Definition: Session.h:309
void RemovePackets(TimePoint t)
Deletes packets from our packet managers for a waveform timestamp.
Definition: Session.cpp:3493
bool OnMemoryPressure(MemoryPressureLevel level, MemoryPressureType type, size_t requestedSize)
Handler for low memory conditions.
Definition: Session.cpp:3554
void DownloadWaveforms()
Pull the waveform data out of the queue and make it current.
Definition: Session.cpp:3183
Filter * GetReferenceFilter(const std::string &name)
Gets the reference instance of a given filter.
Definition: Session.h:585
bool m_triggerOneShot
If true, trigger is currently armed in single-shot mode.
Definition: Session.h:475
std::map< std::shared_ptr< Multimeter >, std::shared_ptr< MultimeterState > > m_meters
Multimeters we are currently connected to.
Definition: Session.h:430
YAML::Node SerializeMetadata()
Serializes metadata about the session / software stack.
Definition: Session.cpp:2125
std::set< std::shared_ptr< Oscilloscope > > m_recentlyTriggeredScopes
Scopes whose data is currently being processed for history.
Definition: Session.h:457
double GetWaveformDownloadRate()
Gets the average rate at which we are pulling waveforms off the scope, in Hz.
Definition: Session.h:221
std::map< std::shared_ptr< Load >, std::shared_ptr< LoadState > > m_loads
Loads we are currently connected to.
Definition: Session.h:433
std::string m_generalNotes
Session notes.
Definition: Session.h:304
bool LoadWaveformDataForScope(int version, const YAML::Node &node, std::shared_ptr< Oscilloscope > scope, const std::string &dataDir)
Loads waveform data for a single scope.
Definition: Session.cpp:533
std::mutex m_filterUpdatingMutex
Mutex for controlling access to filter graph.
Definition: Session.h:412
std::mutex & GetRasterizedWaveformMutex()
Get the mutex controlling access to rasterized waveforms.
Definition: Session.h:293
std::mutex m_packetMgrMutex
Mutex for controlling access to m_packetmgrs.
Definition: Session.h:499
std::shared_ptr< TriggerGroup > GetTriggerGroupForFilter(PausableFilter *filter)
Gets the trigger group that contains a specified filter.
Definition: Session.cpp:2730
std::map< std::string, std::vector< std::string > > m_driverNamesByType
Map of "type" to drivername[].
Definition: Session.h:607
std::mutex m_rasterizedWaveformMutex
Mutex for controlling access to rasterized waveforms.
Definition: Session.h:505
size_t GetInstrumentCount()
Get the number of instruments we're connected to (regardless of type)
Definition: Session.h:261
std::set< FlowGraphNode * > GetAllGraphNodes()
Gets all of our graph nodes (filters plus instrument channels)
Definition: Session.cpp:3315
int m_fileLoadVersion
Version of the file being loaded.
Definition: Session.h:397
std::shared_ptr< TriggerGroup > m_trendTriggerGroup
Trigger group dedicated to trend filters.
Definition: Session.h:445
void MarkChannelDirty(InstrumentChannel *chan)
Flags a single channel as dirty (updated outside of a global trigger event)
Definition: Session.cpp:3419
std::shared_ptr< TriggerGroup > GetTriggerGroupForScope(std::shared_ptr< Oscilloscope > scope)
Gets the trigger group that contains a specified scope.
Definition: Session.cpp:2707
void AddMultimeterDialog(std::shared_ptr< SCPIMultimeter > meter)
Adds a multimeter dialog to the session.
Definition: Session.cpp:2996
std::map< FlowGraphNode *, int64_t > m_lastFilterGraphRuntimeStats
Performance stats from last graph execution.
Definition: Session.h:487
std::map< std::shared_ptr< PowerSupply >, std::shared_ptr< PowerSupplyState > > m_psus
Power supplies we are currently connected to.
Definition: Session.h:427
const std::vector< std::shared_ptr< Oscilloscope > > GetScopes()
Get the set of scopes we're currently connected to.
Definition: Session.h:230
int m_nextMarkerNum
Number for next autogenerated waveform name.
Definition: Session.h:517
int64_t GetLastWaveformRenderTime()
Gets the last run time of the waveform rendering shaders.
Definition: Session.h:215
IDTable m_idtable
ID mapping used for serialization.
Definition: Session.h:299
bool CheckForWaveforms(vk::raii::CommandBuffer &cmdbuf)
Check if new waveform data has arrived.
Definition: Session.cpp:3226
std::map< TimePoint, std::vector< Marker > > m_markers
Map of waveform timestamps to markers.
Definition: Session.h:514
const std::vector< std::shared_ptr< BERT > > GetBERTs()
Get the set of BERTs we're currently connected to.
Definition: Session.h:239
void ArmTrigger(TriggerGroup::TriggerType type, bool all=false)
Arms the trigger for all trigger groups.
Definition: Session.cpp:3087
void UpdatePacketManagers(const std::set< FlowGraphNode * > &nodes, bool nodesListIsComplete)
Update all of the packet managers when new data arrives.
Definition: Session.cpp:3450
std::set< std::shared_ptr< TriggerGroup > > m_recentlyTriggeredGroups
Groups whose data is currently being processed.
Definition: Session.h:460
HistoryManager m_history
Historical waveform data.
Definition: Session.h:496
std::mutex m_scopeMutex
Mutex for controlling access to scope vectors.
Definition: Session.h:406
bool IsSecondaryOfMultiScopeGroup(std::shared_ptr< Oscilloscope > scope)
Check if a scope is a secondary within a multiscope group.
Definition: Session.cpp:2686
std::map< std::shared_ptr< Instrument >, std::shared_ptr< InstrumentConnectionState > > m_instrumentStates
Worker threads and other bookkeeping metadata for instruments.
Definition: Session.h:451
std::shared_ptr< BERTState > GetBERTState(std::shared_ptr< BERT > bert)
Returns a pointer to the state for a BERT.
Definition: Session.h:150
void DestroyReferenceFilters()
Destroys the reference filters.
Definition: Session.cpp:3544
bool m_modifiedSinceLastSave
True if the session has been modified since last time it was saved.
Definition: Session.h:421
std::string GetRegisteredTypeOfDriver(const std::string &drivername)
Performs an exhaustive search of the driver list to see which type this instrument is.
Definition: Session.cpp:898
void ClearSweeps()
Clear state on all of our filters.
Definition: Session.cpp:3428
std::shared_mutex m_waveformDataMutex
Mutex for controlling access to waveform data.
Definition: Session.h:409
bool IsPrimaryOfMultiScopeGroup(std::shared_ptr< Oscilloscope > scope)
Check if a scope is the primary of a group containing at least one other scope.
Definition: Session.cpp:2672
std::mutex m_perfClockMutex
Mutex for controlling access to performance counters.
Definition: Session.h:490
double m_tPrimaryTrigger
Time that the primary scope triggered (in multi-scope setups)
Definition: Session.h:469
void CreateReferenceFilters()
Creates one filter of each known type to use as a reference for what inputs are legal to use to a new...
Definition: Session.cpp:3521
bool RefreshDirtyFilters()
Refresh dirty filters (and anything in their downstream influence cone)
Definition: Session.cpp:3363
Base class for waveforms with nonuniform sample rate.
Definition: Waveform.h:272
A timestamp, measured in seconds + femtoseconds.
Definition: Marker.h:42
Base class for waveforms with data sampled at uniform intervals.
Definition: Waveform.h:355
A WaveformArea is a plot that displays one or more OscilloscopeChannel's worth of data.
Definition: WaveformArea.h:446