Little pause writing a .CSV - Raspberry Pi Forums
hi,
reading sensor values , writting them in csv file in 200hz, have detected program stops while writing in .csv. not know why happens because isolate case. why be?
reading sensor values , writting them in csv file in 200hz, have detected program stops while writing in .csv. not know why happens because isolate case. why be?
code: select all
ofstream fs(filename_map.str()); //save data - general information excel file time_total = (millis()-reference)/1000.0; fs << i++ << ",0,0,0," << setprecision(3) << @ << ","; fs << fixed << setprecision(2) << x << "," << y << "," << z << "," << setprecision(5) << velocity << "," << yaw << ","; fs << setprecision(1) << timehour << "," << setprecision(0) << date << "," ; fs << setprecision(5) << longitude << "," << latitude << "," << altitude << ","; fs << setprecision(3) << time_total << endl;
you might think writing file 200 times second os don't write changes sd-card every time. contents stored in file buffer/cache , @ point os think time push flash , can take variable amount of time.
if need avoid such pauses, might need have reading in 1 thread , writing file in another, , use ringbuffer/stack keep values. if running on singe core rpi (a/b/b+) might never avoid such events.
if need avoid such pauses, might need have reading in 1 thread , writing file in another, , use ringbuffer/stack keep values. if running on singe core rpi (a/b/b+) might never avoid such events.
raspberrypi
Comments
Post a Comment