| 1 |
/*
|
| 2 |
* This file has been modified for the cdrkit suite.
|
| 3 |
*
|
| 4 |
* The behaviour and appearence of the program code below can differ to a major
|
| 5 |
* extent from the version distributed by the original author(s).
|
| 6 |
*
|
| 7 |
* For details, see Changelog file distributed with the cdrkit package. If you
|
| 8 |
* received this file from another source then ask the distributing person for
|
| 9 |
* a log of modifications.
|
| 10 |
*
|
| 11 |
*/
|
| 12 |
|
| 13 |
#include <mconfig.h>
|
| 14 |
#include <stdio.h>
|
| 15 |
#include <standard.h>
|
| 16 |
#include <stdxlib.h>
|
| 17 |
#include <timedefs.h>
|
| 18 |
#include <strdefs.h>
|
| 19 |
|
| 20 |
#define Uchar unsigned char
|
| 21 |
|
| 22 |
static int encspeed(void);
|
| 23 |
|
| 24 |
static int encspeed()
|
| 25 |
{
|
| 26 |
register Uchar *sect;
|
| 27 |
register int i;
|
| 28 |
register int end;
|
| 29 |
register int secs;
|
| 30 |
struct timeval tv;
|
| 31 |
struct timeval tv2;
|
| 32 |
|
| 33 |
sect = malloc(2352);
|
| 34 |
|
| 35 |
secs = 10;
|
| 36 |
end = 75*1000000 * secs;
|
| 37 |
|
| 38 |
memset(sect, 0, sizeof(sect));
|
| 39 |
for (i=0; i < 2352; ) {
|
| 40 |
sect[i++] = 'J';
|
| 41 |
sect[i++] = 'S';
|
| 42 |
}
|
| 43 |
|
| 44 |
gettimeofday(&tv, (struct timezone *)0);
|
| 45 |
for (i=0; i < end; i++) {
|
| 46 |
#ifdef OLD_LIBEDC
|
| 47 |
do_encode_L2(sect, 1, 1);
|
| 48 |
scramble_L2(sect);
|
| 49 |
#else
|
| 50 |
|
| 51 |
/* lec_encode_mode1_sector(12345, sect);*/
|
| 52 |
/* lec_scramble(sect);*/
|
| 53 |
#endif
|
| 54 |
/* if ((i & 31) == 0) {*/
|
| 55 |
if (1) {
|
| 56 |
gettimeofday(&tv2, (struct timezone *)0);
|
| 57 |
if (tv2.tv_sec >= (tv.tv_sec+secs) &&
|
| 58 |
tv2.tv_usec >= tv.tv_usec)
|
| 59 |
break;
|
| 60 |
}
|
| 61 |
}
|
| 62 |
printf("%d sectors/%ds\n", i, secs);
|
| 63 |
printf("%d sectors/s\n", i/secs);
|
| 64 |
printf("speed: %5.2fx\n", (1.0*i)/750.0);
|
| 65 |
return ((i+74)/75) / secs ;
|
| 66 |
}
|
| 67 |
|
| 68 |
int main(int argc, char *argv[])
|
| 69 |
{
|
| 70 |
/* lec_init();*/
|
| 71 |
|
| 72 |
/* printf("speed: %d\n", encspeed());*/
|
| 73 |
encspeed();
|
| 74 |
return (0);
|
| 75 |
}
|