ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/freemol/trunk/src/mpeg_encode/src/parseSchedule.c
Revision: 22
Committed: Mon Jul 7 22:16:37 2008 UTC (11 years, 3 months ago) by wdelano
File size: 1594 byte(s)
Log Message:
initial checkin of mpeg_encode source
Line File contents
1 /*
2
3 SCHEDULE: MACHINE 0 FRAMES 0-2 TIME 750230115-750230122
4 SCHEDULE: MACHINE 1 FRAMES 3-5 TIME 750230115-750230124
5 SCHEDULE: MACHINE 1 FRAME 18-27 TIME 750230124-750230147
6 SCHEDULE: MACHINE 1 FRAME 28-29 TIME 750230147-750230147
7 SCHEDULE: MACHINE 0 FRAME 6-17 TIME 750230122-750230148
8
9 */
10
11 #include <stdio.h>
12
13 int main(int argc, char **argv)
14 {
15 register int index;
16 char input[256];
17 long IOtimes[256];
18 int machineNum;
19 int frameStart, frameEnd;
20 long timeStart, timeEnd;
21 long minTime = 0x7fffffff;
22 FILE *filePtr;
23 long IOtime;
24
25 for ( index = 0; index < 256; index++ )
26 IOtimes[index] = 0;
27
28 filePtr = fopen(argv[1], "r");
29
30 while ( fgets(input, 256, filePtr) != NULL )
31 {
32 sscanf(input, "SCHEDULE: MACHINE %d FRAMES %d-%d TIME %ld-%ld IOTIME %ld",
33 &machineNum, &frameStart, &frameEnd, &timeStart, &timeEnd,
34 &IOtime);
35
36 if ( timeStart < minTime )
37 minTime = timeStart;
38 }
39
40 fclose(filePtr);
41
42 filePtr = fopen(argv[1], "r");
43
44 while ( fgets(input, 256, filePtr) != NULL )
45 {
46 sscanf(input, "SCHEDULE: MACHINE %d FRAMES %d-%d TIME %ld-%ld IOTIME %ld",
47 &machineNum, &frameStart, &frameEnd, &timeStart, &timeEnd,
48 &IOtime);
49
50 fprintf(stdout, "SCHEDULE: MACHINE %2d FRAMES %2d-%2d TIME %3d-%3d IOTIME %2d F/T/I %2d/%2d/%2d\n",
51 machineNum, frameStart, frameEnd,
52 timeStart-minTime, timeEnd-minTime,
53 IOtime-IOtimes[machineNum],
54 frameEnd-frameStart+1,
55 timeEnd-timeStart,
56 IOtime-IOtimes[machineNum]);
57
58 IOtimes[machineNum] = IOtime;
59 }
60
61 fclose(filePtr);
62
63 return 0;
64 }