Changeset 1bd99785 in mainline for uspace/app/wavplay/dplay.c


Ignore:
Timestamp:
2013-03-16T14:44:05Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
39a379a
Parents:
3e6a975a
Message:

dplay: Add timestamp to debug output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wavplay/dplay.c

    r3e6a975a r1bd99785  
    201201}
    202202
     203#define DPRINTF(f, ...) \
     204        printf("%.2lu:%.6lu   "f, time.tv_sec % 100, time.tv_usec, __VA_ARGS__)
     205
    203206
    204207static void play(playback_t *pb)
     
    209212        printf("Playing: %dHz, %s, %d channel(s).\n", pb->f.sampling_rate,
    210213            pcm_sample_format_str(pb->f.sample_format), pb->f.channels);
    211         useconds_t work_time = 50000; /* 10 ms */
     214        useconds_t work_time = 70000; /* 10 ms */
    212215        bool started = false;
    213216        size_t pos = 0;
     217        struct timeval time = { 0 };
     218        getuptime(&time);
    214219        do {
    215220                size_t available = buffer_avail(pb, pos);
     
    218223                    min(available, buffer_remain(pb)), pb->source);
    219224                buffer_advance(pb, bytes);
    220                 printf("POS %zu: %zu bytes free in buffer, read %zu, wp %zu\n",
     225                DPRINTF("POS %zu: %zu bytes free in buffer, read %zu, wp %zu\n",
    221226                    pos, available, bytes, pb->buffer.write_ptr - pb->buffer.base);
    222227                available -= bytes;
     
    226231                            pb->source);
    227232                        buffer_advance(pb, bytes);
    228                         printf("POS %zu: %zu bytes still free in buffer, read %zu, wp %zu\n",
     233                        DPRINTF("POS %zu: %zu bytes still free in buffer, read %zu, wp %zu\n",
    229234                            pos, available, bytes, pb->buffer.write_ptr - pb->buffer.base);
    230235                        available -= bytes;
     
    247252                const useconds_t real_delay = (usecs > work_time)
    248253                    ? usecs - work_time : 0;
    249                 printf("POS %zu: %u usecs (%u) to play %zu bytes.\n",
     254                DPRINTF("POS %zu: %u usecs (%u) to play %zu bytes.\n",
    250255                    pos, usecs, real_delay, to_play);
    251256                if (real_delay)
     
    255260                        printf("Failed to update position indicator\n");
    256261                }
     262                getuptime(&time);
    257263                if (available)
    258264                        break;
     
    298304        printf("Buffer: %p %zu.\n", pb.buffer.base, pb.buffer.size);
    299305
    300         {
    301                 uintptr_t ptr = 0;
    302                 as_get_physical_mapping(pb.buffer.base, &ptr);
    303                 printf("buffer mapped at %x.\n", ptr);
    304         }
    305 
    306306        pb.source = fopen(file, "rb");
    307307        if (pb.source == NULL) {
Note: See TracChangeset for help on using the changeset viewer.