~ubuntu-branches/ubuntu/lucid/ardour/lucid-proposed

« back to all changes in this revision

Viewing changes to libs/ardour/session_butler.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-07-29 11:27:04 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080729112704-x1rmgb4tjotjyu5u
Tags: 1:2.5-0ubuntu1
* New upstream release.
* debian/patches/s390-FTBFS.patch: Dropped, as it fails to apply, and
  Ubuntu doesn't concern itself with s390.
* debian/control:
  - Fix package description, thanks to the patch in Debian bug #485892.
  - Metadata cleanup and sync control/control.in files.
  - Add libaubio-dev to Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
166
166
        uint32_t err = 0;
167
167
        int32_t bytes;
168
168
        bool compute_io;
169
 
        struct timeval begin, end;
 
169
        microseconds_t begin, end;
 
170
 
170
171
        struct pollfd pfd[1];
171
172
        bool disk_work_outstanding = false;
172
173
        DiskstreamList::iterator i;
243
244
                bytes = 0;
244
245
                compute_io = true;
245
246
 
246
 
                gettimeofday (&begin, 0);
 
247
                begin = get_microseconds();
247
248
 
248
249
                boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader ();
249
250
 
290
291
                }
291
292
 
292
293
                if (compute_io) {
293
 
                        gettimeofday (&end, 0);
294
 
                        
295
 
                        double b = begin.tv_sec  + (begin.tv_usec/1000000.0);
296
 
                        double e = end.tv_sec + (end.tv_usec / 1000000.0);
297
 
                        
298
 
                        _read_data_rate = bytes / (e - b);
 
294
                        end = get_microseconds(); 
 
295
                        if(end-begin > 0) {
 
296
                        _read_data_rate = (float) bytes / (float) (end - begin);
 
297
                        } else { _read_data_rate = 0; // infinity better
 
298
                         }
299
299
                }
300
300
 
301
301
                bytes = 0;
302
302
                compute_io = true;
303
 
                gettimeofday (&begin, 0);
 
303
                begin = get_microseconds();
304
304
 
305
305
                for (i = dsl->begin(); !transport_work_requested() && butler_should_run && i != dsl->end(); ++i) {
306
306
                        // cerr << "write behind for " << (*i)->name () << endl;
344
344
                }
345
345
 
346
346
                if (compute_io) {
347
 
                        gettimeofday (&end, 0);
348
 
                        
349
 
                        double b = begin.tv_sec  + (begin.tv_usec/1000000.0);
350
 
                        double e = end.tv_sec + (end.tv_usec / 1000000.0);
351
 
                        
352
 
                        _write_data_rate = bytes / (e - b);
 
347
                        // there are no apparent users for this calculation?
 
348
                        end = get_microseconds();
 
349
                        if(end-begin > 0) {
 
350
                        _write_data_rate = (float) bytes / (float) (end - begin);
 
351
                        } else {
 
352
                        _write_data_rate = 0; // Well, infinity would be better
 
353
                        }
353
354
                }
354
355
                
355
356
                if (!disk_work_outstanding) {
416
417
        /* disk i/o in excess of 10000MB/sec indicate the buffer cache
417
418
           in action. ignore it.
418
419
        */
419
 
        return _read_data_rate > 10485760000.0f ? 0.0f : _read_data_rate;
 
420
        return _read_data_rate > 10485.7600000f ? 0.0f : _read_data_rate;
420
421
}
421
422
 
422
423
float
425
426
        /* disk i/o in excess of 10000MB/sec indicate the buffer cache
426
427
           in action. ignore it.
427
428
        */
428
 
        return _write_data_rate > 10485760000.0f ? 0.0f : _write_data_rate;
 
429
        return _write_data_rate > 10485.7600000f ? 0.0f : _write_data_rate;
429
430
}
430
431
 
431
432
uint32_t