uhtmlparser.c

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <asm/msr.h>

#include "common.h"

int main()
{
unsigned long ini, end, now, best, tsc;
int i;
int fd;
int nhtml = 0, ntext = 0;
char *html, *text;
html = malloc(BUFF_LEN);
text = malloc(BUFF_LEN);
memset(html, 0, BUFF_LEN);
memset(text, 0, BUFF_LEN);

/*time rdsc, i.e. no code*/
best =~ 0;
measure_time(0);
tsc = best;
printf("Time taken for no code: %ld\n", tsc);

/*Measure time for reading a file*/
fd = open(FILE_NAME, O_RDONLY, 0600);
if(!fd){
printf("Error opening file\n");
exit(1);
}
best = ~0;
measure_time(read(fd, html, 1000));
printf("Time taken by read: %li\n", best - tsc);
parse_html(html, text);
printf("Parsed text: %s\n", text);
}