13
0

Remove unused read/write data count code.

git-svn-id: svn://localhost/ardour2/branches/3.0@10300 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-10-24 20:45:29 +00:00
parent 8404d7ff94
commit 75e6adcf03
25 changed files with 1 additions and 198 deletions

View File

@ -102,8 +102,7 @@ class AudioRegion : public Region
ReadOpsNone = 0x0,
ReadOpsOwnAutomation = 0x1,
ReadOpsOwnScaling = 0x2,
ReadOpsCount = 0x4,
ReadOpsFades = 0x8
ReadOpsFades = 0x4
};
virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const;

View File

@ -67,10 +67,6 @@ class AudioSource : virtual public Source,
void set_captured_for (std::string str) { _captured_for = str; }
std::string captured_for() const { return _captured_for; }
uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
void dec_read_data_count (framecnt_t);
int read_peaks (PeakData *peaks, framecnt_t npeaks,
framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const;
@ -131,9 +127,6 @@ class AudioSource : virtual public Source,
std::string peakpath;
std::string _captured_for;
mutable uint32_t _read_data_count; // modified in read()
mutable uint32_t _write_data_count; // modified in write()
int initialize_peakfile (bool newfile, std::string path);
int build_peaks_from_scratch ();
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,

View File

@ -51,9 +51,6 @@ class Butler : public SessionHandleRef
bool transport_work_requested() const;
void drop_references ();
float read_data_rate() const; ///< in usec
float write_data_rate() const;
framecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; }
framecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; }
uint32_t midi_diskstream_buffer_size() const { return midi_dstream_buffer_size; }

View File

@ -175,9 +175,6 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void reset_write_sources (bool, bool force = false) = 0;
virtual void non_realtime_input_change () = 0;
uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
protected:
friend class Auditioner;
virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0;
@ -290,9 +287,6 @@ class Diskstream : public SessionObject, public PublicDiskstream
framepos_t playback_sample;
framecnt_t playback_distance;
uint32_t _read_data_count;
uint32_t _write_data_count;
bool in_set_state;
Glib::Mutex state_lock;

View File

@ -95,9 +95,6 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this<
std::string captured_for() const { return _captured_for; }
void set_captured_for (std::string str) { _captured_for = str; }
uint32_t read_data_count() const { return _read_data_count; }
uint32_t write_data_count() const { return _write_data_count; }
framepos_t last_write_end() const { return _last_write_end; }
void set_last_write_end (framepos_t pos) { _last_write_end = pos; }
@ -155,8 +152,6 @@ class MidiSource : virtual public Source, public boost::enable_shared_from_this<
framecnt_t cnt) = 0;
std::string _captured_for;
mutable uint32_t _read_data_count; ///< modified in read()
mutable uint32_t _write_data_count; ///< modified in write()
boost::shared_ptr<MidiModel> _model;
bool _writing;

View File

@ -201,8 +201,6 @@ public:
void raise_region_to_top (boost::shared_ptr<Region>);
void lower_region_to_bottom (boost::shared_ptr<Region>);
uint32_t read_data_count() const { return _read_data_count; }
/* XXX: use of diskstream here is a little unfortunate */
const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; }
void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; }
@ -292,7 +290,6 @@ public:
bool in_partition;
bool _frozen;
uint32_t subcnt;
uint32_t _read_data_count;
PBD::ID _orig_diskstream_id;
uint64_t layer_op_counter;
framecnt_t freeze_length;

View File

@ -43,8 +43,6 @@ public:
virtual float capture_buffer_load () const = 0;
virtual int do_refill () = 0;
virtual int do_flush (RunContext, bool force = false) = 0;
virtual uint32_t read_data_count() const = 0;
virtual uint32_t write_data_count() const = 0;
virtual void set_pending_overwrite (bool) = 0;
virtual int seek (framepos_t, bool complete_refill = false) = 0;
virtual bool hidden () const = 0;

View File

@ -221,8 +221,6 @@ class Region
int apply (Filter &, Progress* progress = 0);
virtual uint64_t read_data_count () const { return _read_data_count; }
boost::shared_ptr<ARDOUR::Playlist> playlist () const { return _playlist.lock(); }
virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>);
@ -385,7 +383,6 @@ class Region
Timecode::BBT_Time _bbt_time;
AnalysisFeatureList _transients;
mutable uint64_t _read_data_count; ///< modified in read()
uint64_t _last_layer_op; ///< timestamp
SourceList _sources;
/** Used when timefx are applied, so we can always use the original source */

View File

@ -120,8 +120,6 @@ class Track : public Route, public PublicDiskstream
float capture_buffer_load () const;
int do_refill ();
int do_flush (RunContext, bool force = false);
uint32_t read_data_count() const;
uint32_t write_data_count() const;
void set_pending_overwrite (bool);
int seek (framepos_t, bool complete_refill = false);
bool hidden () const;

View File

@ -940,8 +940,6 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
return -1;
}
_read_data_count = _playlist->read_data_count();
if (reversed) {
swap_by_ptr (buf, buf + this_read - 1);
@ -1218,8 +1216,6 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush)
RingBufferNPT<CaptureTransition>::rw_vector transvec;
framecnt_t total;
_write_data_count = 0;
transvec.buf[0] = 0;
transvec.buf[1] = 0;
vector.buf[0] = 0;
@ -1325,8 +1321,6 @@ AudioDiskstream::do_flush (RunContext /*context*/, bool force_flush)
return -1;
}
_write_data_count += (*chan)->write_source->write_data_count();
(*chan)->capture_buf->increment_read_ptr (to_write);
(*chan)->curr_capture_cnt += to_write;
}

View File

@ -286,9 +286,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
Glib::RecMutex::Lock rm (region_lock);
framepos_t const end = start + cnt - 1;
_read_data_count = 0;
_read_data_count = 0;
RegionList* rlist = regions_to_read (start, start+cnt);
@ -346,16 +343,11 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, fr
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read from region %1\n", ar->name()));
assert(ar);
ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
_read_data_count += ar->read_data_count();
}
for (vector<boost::shared_ptr<Crossfade> >::iterator i = x.begin(); i != x.end(); ++i) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read from xfade between %1 & %2\n", (*i)->out()->name(), (*i)->in()->name()));
(*i)->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
/* don't JACK up _read_data_count, since its the same data as we just
read from the regions, and the OS should handle that for us.
*/
}
}

View File

@ -433,10 +433,6 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit,
mixdown_buffer += buf_offset;
}
if (rops & ReadOpsCount) {
_read_data_count = 0;
}
if (chan_n < n_channels()) {
boost::shared_ptr<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (srcs[chan_n]);
@ -444,10 +440,6 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit,
return 0; /* "read nothing" */
}
if (rops & ReadOpsCount) {
_read_data_count += src->read_data_count();
}
} else {
/* track is N-channel, this region has less channels; silence the ones
@ -465,8 +457,6 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit,
return 0; /* "read nothing" */
}
/* adjust read data count appropriately since this was a duplicate read */
src->dec_read_data_count (to_read);
} else {
memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
}

View File

@ -68,8 +68,6 @@ AudioSource::AudioSource (Session& s, string name)
_peaks_built = false;
_peak_byte_max = 0;
_peakfile_descriptor = 0;
_read_data_count = 0;
_write_data_count = 0;
peak_leftover_cnt = 0;
peak_leftover_size = 0;
peak_leftovers = 0;
@ -83,8 +81,6 @@ AudioSource::AudioSource (Session& s, const XMLNode& node)
_peaks_built = false;
_peak_byte_max = 0;
_peakfile_descriptor = 0;
_read_data_count = 0;
_write_data_count = 0;
peak_leftover_cnt = 0;
peak_leftover_size = 0;
peak_leftovers = 0;
@ -950,18 +946,6 @@ AudioSource::available_peaks (double zoom_factor) const
return (end/sizeof(PeakData)) * _FPP;
}
void
AudioSource::dec_read_data_count (framecnt_t cnt)
{
uint32_t val = cnt * sizeof (Sample);
if (val < _read_data_count) {
_read_data_count -= val;
} else {
_read_data_count = 0;
}
}
void
AudioSource::mark_streaming_write_completed ()
{

View File

@ -35,9 +35,6 @@
using namespace PBD;
static float _read_data_rate;
static float _write_data_rate;
namespace ARDOUR {
Butler::Butler(Session& s)
@ -144,9 +141,6 @@ void *
Butler::thread_work ()
{
uint32_t err = 0;
int32_t bytes;
bool compute_io;
microseconds_t begin, end;
struct pollfd pfd[1];
bool disk_work_outstanding = false;
@ -217,9 +211,6 @@ Butler::thread_work ()
}
bytes = 0;
compute_io = true;
restart:
disk_work_outstanding = false;
@ -227,8 +218,6 @@ restart:
_session.butler_transport_work ();
}
begin = get_microseconds();
boost::shared_ptr<RouteList> rl = _session.get_routes();
RouteList rl_with_auditioner = *rl;
@ -254,16 +243,11 @@ restart:
}
switch (tr->do_refill ()) {
case 0:
bytes += tr->read_data_count();
break;
case 1:
bytes += tr->read_data_count();
disk_work_outstanding = true;
break;
default:
compute_io = false;
error << string_compose(_("Butler read ahead failure on dstream %1"), (*i)->name()) << endmsg;
break;
}
@ -279,19 +263,6 @@ restart:
goto restart;
}
if (compute_io) {
end = get_microseconds();
if (end - begin > 0) {
_read_data_rate = (float) bytes / (float) (end - begin);
} else {
_read_data_rate = 0; // infinity better
}
}
bytes = 0;
compute_io = true;
begin = get_microseconds();
for (i = rl->begin(); !transport_work_requested() && should_run && i != rl->end(); ++i) {
// cerr << "write behind for " << (*i)->name () << endl;
@ -305,17 +276,12 @@ restart:
*/
switch (tr->do_flush (ButlerContext)) {
case 0:
bytes += tr->write_data_count();
break;
case 1:
bytes += tr->write_data_count();
disk_work_outstanding = true;
break;
default:
err++;
compute_io = false;
error << string_compose(_("Butler write-behind failure on dstream %1"), (*i)->name()) << endmsg;
/* don't break - try to flush all streams in case they
are split across disks.
@ -339,16 +305,6 @@ restart:
goto restart;
}
if (compute_io) {
// there are no apparent users for this calculation?
end = get_microseconds();
if (end - begin > 0) {
_write_data_rate = (float) bytes / (float) (end - begin);
} else {
_write_data_rate = 0; // Well, infinity would be better
}
}
if (!disk_work_outstanding) {
_session.refresh_disk_space ();
}
@ -414,24 +370,6 @@ Butler::transport_work_requested () const
return g_atomic_int_get(&should_do_transport_work);
}
float
Butler::read_data_rate () const
{
/* disk i/o in excess of 10000MB/sec indicate the buffer cache
in action. ignore it.
*/
return _read_data_rate > 10485.7600000f ? 0.0f : _read_data_rate;
}
float
Butler::write_data_rate () const
{
/* disk i/o in excess of 10000MB/sec indicate the buffer cache
in action. ignore it.
*/
return _write_data_rate > 10485.7600000f ? 0.0f : _write_data_rate;
}
void
Butler::empty_pool_trash ()
{

View File

@ -174,7 +174,6 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) c
if (n_channels == 1) {
if (safe_read (dst, start, file_cnt, abl) == 0) {
_read_data_count = cnt * sizeof (Sample);
return cnt;
}
return 0;
@ -187,8 +186,6 @@ CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) c
return 0;
}
_read_data_count = cnt * sizeof(float);
Sample *ptr = interleave_buf + _channel;
/* stride through the interleaved data */

View File

@ -110,8 +110,6 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
, _read_data_count (0)
, _write_data_count (0)
, in_set_state (false)
, _flags (flag)
, deprecated_io_node (0)
@ -153,8 +151,6 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
, _read_data_count (0)
, _write_data_count (0)
, in_set_state (false)
, _flags (Recordable)
, deprecated_io_node (0)

View File

@ -769,8 +769,6 @@ MidiDiskstream::read (framepos_t& start, framecnt_t dur, bool reversed)
g_atomic_int_add(&_frames_written_to_ringbuffer, this_read);
_read_data_count = _playlist->read_data_count();
if (reversed) {
// Swap note ons with note offs here. etc?
@ -873,8 +871,6 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
assert (!destructive());
_write_data_count = 0;
total = _session.transport_frame() - _write_source->last_write_end();
if (total == 0 ||

View File

@ -102,8 +102,6 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
framepos_t end = start + dur - 1;
_read_data_count = 0;
// relevent regions overlapping start <--> end
vector< boost::shared_ptr<Region> > regs;
typedef pair<MidiStateTracker*,framepos_t> TrackerInfo;
@ -181,8 +179,6 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
_note_trackers.insert (newpair);
DEBUG_TRACE (DEBUG::MidiPlaylistIO, "\tadded tracker to trackers\n");
}
_read_data_count += mr->read_data_count();
}
} else {
@ -234,7 +230,6 @@ MidiPlaylist::read (Evoral::EventSink<framepos_t>& dst, framepos_t start, framec
mr->read_at (evlist, start, dur, chan_n, _note_mode, tracker);
_read_data_count += mr->read_data_count();
#ifndef NDEBUG
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("After %1 (%2 .. %3) we now have %4\n", mr->name(), mr->position(), mr->last_frame(), evlist.size()));

View File

@ -222,8 +222,6 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<framepos_t>&
return 0; /* read nothing */
}
_read_data_count = 0;
boost::shared_ptr<MidiSource> src = midi_source(chan_n);
src->set_note_mode(mode);
@ -248,8 +246,6 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<framepos_t>&
return 0; /* "read nothing" */
}
_read_data_count += src->read_data_count();
return to_read;
}

View File

@ -55,8 +55,6 @@ PBD::Signal1<void,MidiSource*> MidiSource::MidiSourceCreated;
MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
: Source(s, DataType::MIDI, name, flags)
, _read_data_count(0)
, _write_data_count(0)
, _writing(false)
, _model_iter_valid(false)
, _length_beats(0.0)
@ -67,17 +65,12 @@ MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
MidiSource::MidiSource (Session& s, const XMLNode& node)
: Source(s, node)
, _read_data_count(0)
, _write_data_count(0)
, _writing(false)
, _model_iter_valid(false)
, _length_beats(0.0)
, _last_read_end(0)
, _last_write_end(0)
{
_read_data_count = 0;
_write_data_count = 0;
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}

View File

@ -185,7 +185,6 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
in_flush = false;
in_partition = false;
subcnt = 0;
_read_data_count = 0;
_frozen = other->_frozen;
layer_op_counter = other->layer_op_counter;
@ -319,7 +318,6 @@ Playlist::init (bool hide)
in_flush = false;
in_partition = false;
subcnt = 0;
_read_data_count = 0;
_frozen = false;
layer_op_counter = 0;
freeze_length = 0;

View File

@ -217,7 +217,6 @@ Region::Region (Session& s, framepos_t start, framecnt_t length, const string& n
, _last_length (length)
, _last_position (0)
, _first_edit (EditChangesNothing)
, _read_data_count(0)
, _last_layer_op(0)
, _pending_explicit_relayer (false)
{
@ -234,7 +233,6 @@ Region::Region (const SourceList& srcs)
, _last_length (0)
, _last_position (0)
, _first_edit (EditChangesNothing)
, _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
{
@ -256,7 +254,6 @@ Region::Region (boost::shared_ptr<const Region> other)
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
, _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
@ -329,7 +326,6 @@ Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset)
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
, _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
@ -387,7 +383,6 @@ Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
, _last_length (other->_last_length)
, _last_position (other->_last_position)
, _first_edit (EditChangesID)
, _read_data_count (0)
, _last_layer_op (other->_last_layer_op)
, _pending_explicit_relayer (false)
{

View File

@ -127,8 +127,6 @@ SMFSource::read_unlocked (Evoral::EventSink<framepos_t>& destination, framepos_t
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: start %1 duration %2\n", start, duration));
_read_data_count = 0;
// Output parameters for read_event (which will allocate scratch in buffer as needed)
uint32_t ev_delta_t = 0;
uint32_t ev_type = 0;
@ -203,8 +201,6 @@ SMFSource::read_unlocked (Evoral::EventSink<framepos_t>& destination, framepos_t
break;
}
_read_data_count += ev_size;
if (ev_size > scratch_size) {
scratch_size = ev_size;
}
@ -225,8 +221,6 @@ SMFSource::write_unlocked (MidiRingBuffer<framepos_t>& source, framepos_t positi
mark_streaming_write_started ();
}
_write_data_count = 0;
framepos_t time;
Evoral::EventType type;
uint32_t size;
@ -335,9 +329,6 @@ SMFSource::append_event_unlocked_beats (const Evoral::Event<double>& ev)
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
_last_ev_time_beats = ev.time();
_write_data_count += ev.size();
}
/** Append an event with a timestamp in frames (framepos_t) */
@ -385,9 +376,6 @@ SMFSource::append_event_unlocked_frames (const Evoral::Event<framepos_t>& ev, fr
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
_last_ev_time_frames = ev.time();
_write_data_count += ev.size();
}
XMLNode&

View File

@ -327,7 +327,6 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
if (_info.channels == 1) {
framecnt_t ret = sf_read_float (sf, dst, file_cnt);
_read_data_count = ret * sizeof(float);
if (ret != file_cnt) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
@ -353,8 +352,6 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
ptr += _info.channels;
}
_read_data_count = cnt * sizeof(float);
_descriptor->release ();
return nread;
}
@ -401,8 +398,6 @@ SndFileSource::nondestructive_write_unlocked (Sample *data, framecnt_t cnt)
compute_and_write_peaks (data, frame_pos, cnt, false, true);
}
_write_data_count = cnt;
return cnt;
}

View File

@ -618,12 +618,6 @@ Track::use_new_playlist ()
return _diskstream->use_new_playlist ();
}
uint32_t
Track::read_data_count () const
{
return _diskstream->read_data_count ();
}
void
Track::set_align_style (AlignStyle s, bool force)
{
@ -636,12 +630,6 @@ Track::set_align_choice (AlignChoice s, bool force)
_diskstream->set_align_choice (s, force);
}
uint32_t
Track::write_data_count () const
{
return _diskstream->write_data_count ();
}
PBD::ID const &
Track::diskstream_id () const
{