Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
23rd September 2008, 08:12 | #10 | Link | |
Guest
Posts: n/a
|
Quote:
Code:
uint32 ringsize = 0x40000; unit32 ringbuffer[ringsize]; uint32 i = 0; // entry pointer in trace file fopen(...) // initialize the buffer fread(ringbuffer, sizeof(uint32), ringsize, trace_file); while (1) { printf("current pc is: %08d\n", ringbuffer[i % ringsize]); i++; // switch to next pc entry // usually we could write and read at the same time (two threads) // i assume only one thread so i refresh/write the entire buffer at once if( i % ringsize == 0) // check if are back to our starting point (walked the ring all the way around). if so refresh the buffer { // read the next MB into the buffer fread(ringbuffer, sizeof(uint32), ringsize, trace_file); } } Last edited by Oopho2ei; 23rd September 2008 at 16:31. Reason: added missing "== 0" |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|