From: Matthieu C. <ma...@us...> - 2005-06-27 08:52:44
|
Update of /cvsroot/nptltracetool/trace/nptl-trace In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7749 Modified Files: trace_write_bin.c Log Message: fix bug Index: trace_write_bin.c =================================================================== RCS file: /cvsroot/nptltracetool/trace/nptl-trace/trace_write_bin.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- trace_write_bin.c 27 Jun 2005 08:21:05 -0000 1.13 +++ trace_write_bin.c 27 Jun 2005 08:52:31 -0000 1.14 @@ -93,14 +93,9 @@ file_size = 0; } -static inline void write_trace(size_t start, size_t nmemb, char *binary, header_t *header) +static inline void write_trace(size_t start, size_t nmemb) { size_t write_size; - //printf("s %d %d\n", file_size*SZ_WORD, max_size); - /* flip-flop */ - if ((max_size && file_size*SZ_WORD > max_size) || !stream) - new_file(binary, header); - write_size = fwrite((const void*)(buf->array + start), SZ_WORD, nmemb, stream); if (write_size != nmemb) { perror("fwrite failed"); @@ -125,19 +120,27 @@ TRACE_TRACE(TRACE_DBG_WRITE, "writting between beg=%u and end=%u, start=%u and stop=%u\n", beg, end, start, stop); #endif + //printf("s %d %d\n", file_size*SZ_WORD, max_size); + /* flip-flop */ + /* We want to have complete point trace in file, so we need + * to slip here and not in write_trace + */ + if ((max_size && file_size*SZ_WORD > max_size) || !stream) + new_file(binary, header); + /* Write data in two parts: firstly between beg%SIZE and SIZE, and secondly if end%SIZE != 0, between 0 and end%SIZE */ if (stop < start) { - write_trace(start, TRACE_SIZE - start, binary, header); + write_trace(start, TRACE_SIZE - start); if (stop != 0) { - write_trace(0, stop, binary, header); + write_trace(0, stop); } return (TRACE_SIZE - start + stop); } else { - write_trace(start, stop - start, binary, header); + write_trace(start, stop - start); return stop - start; } } |