Skip to content

Commit

Permalink
[TMP] Add temporary code for consistent output
Browse files Browse the repository at this point in the history
  • Loading branch information
Sea-n committed Dec 16, 2023
1 parent e98eaca commit e5012f4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,7 @@ read_lines (FILE *fp, GLog *glog, int dry_run) {
for (int k = 0; k < conf.jobs; k++)
pthread_join (threads[k], &status);

#ifdef USE_THIS_VERSION_AFTER_MERGE
for (int k = 0; k < conf.jobs; k++) {
for (int i = 0; i < jobs[k].p; i++) {
if (jobs[k].logitems[i] == NULL)
Expand All @@ -2094,6 +2095,32 @@ read_lines (FILE *fp, GLog *glog, int dry_run) {
test &= jobs[k].test;
jobs[k].p = 0;
}
#else
/* FIXME: Unnecessarily maintain the log order as the serial version.
* This is to ensure nothing goes wrong by comparing out-{old,new}.csv
* Only for code review / code test, would force-push with above version before merged.
*/
int p2[conf.jobs];
for (int k = 0; k < conf.jobs; k++)
p2[k] = 0;
j = 0;
while (p2[j] <= CHUNK_SIZE) {
if (p2[j] < jobs[j].p && jobs[j].logitems[p2[j]] != NULL) {
if (!dry_run && jobs[j].logitems[p2[j]]->errstr == NULL)
process_log (jobs[j].logitems[p2[j]]);
free_glog (jobs[j].logitems[p2[j]]);
}
p2[j]++;
j = (j + 1) % conf.jobs;
}

for (int k = 0; k < conf.jobs; k++) {
cnt += jobs[k].cnt;
jobs[k].cnt = 0;
test &= jobs[k].test;
jobs[k].p = 0;
}
#endif

if (dry_run && cnt >= NUM_TESTS)
goto out;
Expand Down

0 comments on commit e5012f4

Please sign in to comment.