file writing
void write_logfile(char* filename, int endtime, double duration, stream_task_t* task){
if(global_avg_tput == 0) return;
FILE *f = fopen(filename, "a");
fprintf(f, "%d %f %d %d %d %s %s\n",
endtime,
duration,
task->tput,
global_avg_tput,
task->cur_bitrate,
arg_www_ip,
task->chunk_name);
fclose(f);
}