MessageLogger--can it write each line immediately?!

Support forum for MegunoLink
Post Reply
RandallMcRee
Posts: 3
Joined: Wed Jun 24, 2020 12:37 am

Wed Jun 24, 2020 12:45 am

My application is an 8.5 digit multimeter that uses megunolink. I use the message logger to output to a log file. I need to get the data into another program for real-time processing. Further processing needs 1) to use 64-bit double precision and 2) information available from other DMMs that are on a GPIB bus. So the framework I have to do this requires fusing the information from the megunolink DMM with GPIB DMMs using log files.

Long story short this works best if the message logger actually writes to the log without delay. Is there any way to accomplish this?

Thanks,
Randall.
e.g some Data:
2020-06-23 17:30:36: 5776140: C= 9.99977888
2020-06-23 17:30:37: 5777047: T= 28.64
2020-06-23 17:30:39: 5779226: C= 9.99977854
philr
Posts: 446
Joined: Mon May 26, 2014 10:58 am

Wed Jun 24, 2020 8:50 am

Hi, this is a limitation with the operating system. It chooses the right time to write data to disk. You can use the commands to stop and start the log from the arduino which I think will trigger the OS to write to disk.

Let me know how it goes.
Cheers
Phil
RandallMcRee
Posts: 3
Joined: Wed Jun 24, 2020 12:37 am

Wed Jun 24, 2020 5:18 pm

Sure, I can try that. It will be more expensive, certainly, than just calling
fflush
on the file. That is the correct way to do it--if you have a file handle.
https://www.techonthenet.com/c_language ... %20buffer.

My GPIB program (I don't have the source code) explicitly mentions this as the way to allow other programs monitoring the file to pick up the data in a timely manner. Also, you don't lose any data should the program writing the file crash.

Thanks,
Randall
RandallMcRee
Posts: 3
Joined: Wed Jun 24, 2020 12:37 am

Wed Jun 24, 2020 11:13 pm

Yes, a periodic

message.StopLogging();
message.StartLogging();

does the trick.
philr
Posts: 446
Joined: Mon May 26, 2014 10:58 am

Thu Jun 25, 2020 8:28 am

Great! We will add a flush command in a future update.

Cheers
Phil
Post Reply