PulseView  unreleased development snapshot
A Qt-based sigrok GUI
pv::data::LogicSegment Class Reference

#include <logicsegment.hpp>

Inheritance diagram for pv::data::LogicSegment:
Collaboration diagram for pv::data::LogicSegment:

Classes

struct  MipMapLevel
 

Public Types

typedef pair< int64_t, bool > EdgePair
 

Public Member Functions

 LogicSegment (pv::data::Logic &owner, uint32_t segment_id, unsigned int unit_size, uint64_t samplerate)
 
virtual ~LogicSegment ()
 
shared_ptr< const LogicSegmentget_shared_ptr () const
 
void append_payload (shared_ptr< sigrok::Logic > logic)
 
void append_payload (void *data, uint64_t data_size)
 
void append_subsignal_payload (unsigned int index, void *data, uint64_t data_size, vector< uint8_t > &destination)
 
void get_samples (int64_t start_sample, int64_t end_sample, uint8_t *dest) const
 
void get_subsampled_edges (vector< EdgePair > &edges, uint64_t start, uint64_t end, float min_length, int sig_index, bool first_change_only=false)
 
void get_surrounding_edges (vector< EdgePair > &dest, uint64_t origin_sample, float min_length, int sig_index)
 
- Public Member Functions inherited from pv::data::Segment
 Segment (uint32_t segment_id, uint64_t samplerate, unsigned int unit_size)
 
virtual ~Segment ()
 
uint64_t get_sample_count () const
 
const pv::util::Timestampstart_time () const
 
double samplerate () const
 
void set_samplerate (double samplerate)
 
unsigned int unit_size () const
 
uint32_t segment_id () const
 
void set_complete ()
 
bool is_complete () const
 
void free_unused_memory ()
 

Static Public Attributes

static const unsigned int ScaleStepCount = 10
 
static const int MipMapScalePower = 4
 
static const int MipMapScaleFactor = 1 << MipMapScalePower
 
static const float LogMipMapScaleFactor = logf(MipMapScaleFactor)
 
static const uint64_t MipMapDataUnit = 64 * 1024
 

Private Member Functions

uint64_t unpack_sample (const uint8_t *ptr) const
 
void pack_sample (uint8_t *ptr, uint64_t value)
 
void reallocate_mipmap_level (MipMapLevel &m)
 
void append_payload_to_mipmap ()
 
uint64_t get_unpacked_sample (uint64_t index) const
 
template<class T >
void downsampleTmain (const T *&in, T &acc, T &prev)
 
template<class T >
void downsampleT (const uint8_t *in, uint8_t *&out, uint64_t len)
 
void downsampleGeneric (const uint8_t *in, uint8_t *&out, uint64_t len)
 
uint64_t get_subsample (int level, uint64_t offset) const
 
template<>
void downsampleTmain (const uint8_t *&in, uint8_t &acc, uint8_t &prev)
 
template<>
void downsampleTmain (const uint16_t *&in, uint16_t &acc, uint16_t &prev)
 

Static Private Member Functions

static uint64_t pow2_ceil (uint64_t x, unsigned int power)
 

Private Attributes

Logicowner_
 
struct MipMapLevel mip_map_ [ScaleStepCount]
 
uint64_t last_append_sample_
 
uint64_t last_append_accumulator_
 
uint64_t last_append_extra_
 

Friends

struct LogicSegmentTest::Pow2
 
struct LogicSegmentTest::Basic
 
struct LogicSegmentTest::LargeData
 
struct LogicSegmentTest::Pulses
 
struct LogicSegmentTest::LongPulses
 

Additional Inherited Members

- Signals inherited from pv::data::Segment
void completed ()
 
- Protected Member Functions inherited from pv::data::Segment
void append_single_sample (void *data)
 
void append_samples (void *data, uint64_t samples)
 
const uint8_t * get_raw_sample (uint64_t sample_num) const
 
void get_raw_samples (uint64_t start, uint64_t count, uint8_t *dest) const
 
SegmentDataIteratorbegin_sample_iteration (uint64_t start)
 
void continue_sample_iteration (SegmentDataIterator *it, uint64_t increase)
 
void end_sample_iteration (SegmentDataIterator *it)
 
uint8_t * get_iterator_value (SegmentDataIterator *it)
 
uint64_t get_iterator_valid_length (SegmentDataIterator *it)
 
- Protected Attributes inherited from pv::data::Segment
uint32_t segment_id_
 
recursive_mutex mutex_
 
deque< uint8_t * > data_chunks_
 
uint8_t * current_chunk_
 
uint64_t used_samples_
 
uint64_t unused_samples_
 
atomic< uint64_t > sample_count_
 
pv::util::Timestamp start_time_
 
double samplerate_
 
uint64_t chunk_size_
 
unsigned int unit_size_
 
int iterator_count_
 
bool mem_optimization_requested_
 
bool is_complete_
 

Detailed Description

Definition at line 51 of file logicsegment.hpp.


Class Documentation

struct pv::data::LogicSegment::MipMapLevel

Definition at line 65 of file logicsegment.hpp.

Collaboration diagram for pv::data::LogicSegment::MipMapLevel:
Class Members
void * data
uint64_t data_length
uint64_t length

Member Typedef Documentation

typedef pair<int64_t, bool> pv::data::LogicSegment::EdgePair

Definition at line 56 of file logicsegment.hpp.

Constructor & Destructor Documentation

pv::data::LogicSegment::LogicSegment ( pv::data::Logic owner,
uint32_t  segment_id,
unsigned int  unit_size,
uint64_t  samplerate 
)

Definition at line 52 of file logicsegment.cpp.

pv::data::LogicSegment::~LogicSegment ( )
virtual

Definition at line 63 of file logicsegment.cpp.

Member Function Documentation

void pv::data::LogicSegment::append_payload ( shared_ptr< sigrok::Logic >  logic)

Definition at line 335 of file logicsegment.cpp.

Here is the caller graph for this function:

void pv::data::LogicSegment::append_payload ( void *  data,
uint64_t  data_size 
)

Definition at line 343 of file logicsegment.cpp.

Here is the call graph for this function:

void pv::data::LogicSegment::append_payload_to_mipmap ( )
private

Definition at line 631 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::data::LogicSegment::append_subsignal_payload ( unsigned int  index,
void *  data,
uint64_t  data_size,
vector< uint8_t > &  destination 
)

Appends sample data for a single channel where each byte represents one sample - if it's 0 the state is low, if 1 high. Other values are not permitted. Assumes that all channels are having samples added and in the order of 0..n, not n..0. Also assumes the the number of samples added for each channel is constant for every invokation for 0..n. The number of samples hence may only change when index is 0.

Definition at line 366 of file logicsegment.cpp.

Here is the call graph for this function:

void pv::data::LogicSegment::downsampleGeneric ( const uint8_t *  in,
uint8_t *&  out,
uint64_t  len 
)
private

Definition at line 200 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
void pv::data::LogicSegment::downsampleT ( const uint8_t *  in,
uint8_t *&  out,
uint64_t  len 
)
private

Definition at line 148 of file logicsegment.cpp.

template<>
void pv::data::LogicSegment::downsampleTmain ( const uint8_t *&  in,
uint8_t &  acc,
uint8_t &  prev 
)
private

Definition at line 96 of file logicsegment.cpp.

template<>
void pv::data::LogicSegment::downsampleTmain ( const uint16_t *&  in,
uint16_t &  acc,
uint16_t &  prev 
)
private

Definition at line 123 of file logicsegment.cpp.

template<class T >
void pv::data::LogicSegment::downsampleTmain ( const T *&  in,
T &  acc,
T &  prev 
)
private

Definition at line 85 of file logicsegment.cpp.

void pv::data::LogicSegment::get_samples ( int64_t  start_sample,
int64_t  end_sample,
uint8_t *  dest 
) const

Definition at line 391 of file logicsegment.cpp.

Here is the call graph for this function:

shared_ptr< const LogicSegment > pv::data::LogicSegment::get_shared_ptr ( ) const

Using enable_shared_from_this prevents the normal use of shared_ptr instances by users of LogicSegment instances. Instead, shared_ptrs may only be created by the instance itself. See https://en.cppreference.com/w/cpp/memory/enable_shared_from_this

Definition at line 71 of file logicsegment.cpp.

uint64_t pv::data::LogicSegment::get_subsample ( int  level,
uint64_t  offset 
) const
private

Definition at line 729 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::data::LogicSegment::get_subsampled_edges ( vector< EdgePair > &  edges,
uint64_t  start,
uint64_t  end,
float  min_length,
int  sig_index,
bool  first_change_only = false 
)

Parses a logic data segment to generate a list of transitions in a time interval to a given level of detail.

Parameters
[out]edgesThe vector to place the edges into.
[in]startThe start sample index.
[in]endThe end sample index.
[in]min_lengthThe minimum number of samples that can be resolved at this level of detail.
[in]sig_indexThe index of the signal.

Definition at line 406 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::data::LogicSegment::get_surrounding_edges ( vector< EdgePair > &  dest,
uint64_t  origin_sample,
float  min_length,
int  sig_index 
)

Definition at line 575 of file logicsegment.cpp.

Here is the call graph for this function:

uint64_t pv::data::LogicSegment::get_unpacked_sample ( uint64_t  index) const
private

Definition at line 717 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void pv::data::LogicSegment::pack_sample ( uint8_t *  ptr,
uint64_t  value 
)
inlineprivate

Definition at line 299 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t pv::data::LogicSegment::pow2_ceil ( uint64_t  x,
unsigned int  power 
)
staticprivate

Definition at line 737 of file logicsegment.cpp.

Here is the caller graph for this function:

void pv::data::LogicSegment::reallocate_mipmap_level ( MipMapLevel m)
private

Definition at line 615 of file logicsegment.cpp.

Here is the caller graph for this function:

uint64_t pv::data::LogicSegment::unpack_sample ( const uint8_t *  ptr) const
inlineprivate

Definition at line 261 of file logicsegment.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend struct LogicSegmentTest::Basic
friend

Definition at line 149 of file logicsegment.hpp.

friend struct LogicSegmentTest::LargeData
friend

Definition at line 150 of file logicsegment.hpp.

friend struct LogicSegmentTest::LongPulses
friend

Definition at line 152 of file logicsegment.hpp.

friend struct LogicSegmentTest::Pow2
friend

Definition at line 148 of file logicsegment.hpp.

friend struct LogicSegmentTest::Pulses
friend

Definition at line 151 of file logicsegment.hpp.

Member Data Documentation

uint64_t pv::data::LogicSegment::last_append_accumulator_
private

Definition at line 145 of file logicsegment.hpp.

uint64_t pv::data::LogicSegment::last_append_extra_
private

Definition at line 146 of file logicsegment.hpp.

uint64_t pv::data::LogicSegment::last_append_sample_
private

Definition at line 144 of file logicsegment.hpp.

const float pv::data::LogicSegment::LogMipMapScaleFactor = logf(MipMapScaleFactor)
static

Definition at line 61 of file logicsegment.hpp.

struct MipMapLevel pv::data::LogicSegment::mip_map_[ScaleStepCount]
private

Definition at line 143 of file logicsegment.hpp.

const uint64_t pv::data::LogicSegment::MipMapDataUnit = 64 * 1024
static

Definition at line 62 of file logicsegment.hpp.

const int pv::data::LogicSegment::MipMapScaleFactor = 1 << MipMapScalePower
static

Definition at line 60 of file logicsegment.hpp.

const int pv::data::LogicSegment::MipMapScalePower = 4
static

Definition at line 59 of file logicsegment.hpp.

Logic& pv::data::LogicSegment::owner_
private

Definition at line 141 of file logicsegment.hpp.

const unsigned int pv::data::LogicSegment::ScaleStepCount = 10
static

Definition at line 58 of file logicsegment.hpp.


The documentation for this class was generated from the following files: