-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add code to optionally write status file contents to a JSON file #7
base: wowczarek-2.3.2-libcck
Are you sure you want to change the base?
Add code to optionally write status file contents to a JSON file #7
Conversation
Nice work mate. I like parson, the licencing also works. Logging needs to be reworked anyway, this may work for your use case and is very useful in general, but I need have a think to see if this can be merged as is or not. Cheers, |
Yes - abstraction into datasets is the goal. Json or text should only be a view. This periodic writing of file was always a stop gap. This needs an API and a query client. Ptpq for the lack of a better name. |
Cool, happy to help as I can with a more abstract design. Didn't want to start a big refactor like that now though as I didn't know what other branches you might be planning. |
master clock is also the clock from which PTP is running as master.
- Added delayOnce to timers to mitigate clustered timers firing, but not as previously, always randomise every timer
e0288e5
to
0ac4667
Compare
…ture rather than a string
0ac4667
to
7b3dac5
Compare
Definitely not safe to merge yet, there's a memory leak somewhere :-) I must be leaving Parson objects lying around. |
This PR will add two new config options - global:log_json and global:json_file, which control writing a JSON formatted status file. The JSON file contains mostly the same information as the status file, but it's not a like for like copy.
The repository now bundles in kgabis/parson as it's JSON serialiser, which is MIT license (hopefully that's OK).
The code itself is rather poor - I've duplicated the writeStatusFile() function into writeJsonFile(), which means all the status information is queried twice (clock drivers stats, etc). I've done it this way though because it's very easy to merge - there should be only additive changes.
A better way to do this whole thing would be to abstract the gathering of status information into an internal structure that multiple writer functions could reference (it would make it very easy to create a socket writer function then). That's a rather large refactor though, and I didn't want to try take that on if you've got more branches of your own coming. I've also made some questionable calls to data inside the libcck structures that should probably be replaced with get() methods in the future.