view fibmap_mplayer.c @ 2823:004ee19ebfcf

Extract parallelism from OSD stuff + MMX2 optimization. I've found that mplayer's measuring is not precise :( Here my test with using RDTSC: Old stuff: rd_tsc: 774377 rd_tsc: 765985 rd_tsc: 265309 New CPU optimized stuff: rd_tsc: 661154 rd_tsc: 641317 rd_tsc: 222448 New MMX2 optimized stuff: rd_tsc: 269544 rd_tsc: 329189 rd_tsc: 173110
author nick
date Sun, 11 Nov 2001 11:18:50 +0000
parents 5216f108cb4f
children 04b2227ab75a
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>

#ifndef FIBMAP
#define FIBMAP 1
#endif

int main ( int argc , char ** argv )
{
	int fd,lba=0;
	if (argc!=2) {
	    fprintf(stderr,"Bad usage.\n");
	    return 1;
	}
	if ((fd = open(argv[1], O_RDONLY)) == -1) {
    	    fprintf(stderr,"Cannot open file %s: %s\n",
	    argv[1] ? argv[1] : "(NULL)", strerror(errno));
    	    return 1;
	}
        if (ioctl(fd, FIBMAP, &lba) != 0) {
	    fprintf(stderr,"fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
            close(fd);
            return 1;
        }
	close(fd);
	fprintf(stderr,"%d\n",lba);
	return 0;
}