Skip to content
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

Open
wants to merge 8 commits into
base: wowczarek-2.3.2-libcck
Choose a base branch
from

Conversation

lukebigum
Copy link

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.

@wowczarek
Copy link
Owner

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,
Wojciech

@wowczarek
Copy link
Owner

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.

@lukebigum
Copy link
Author

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.

wowczarek and others added 3 commits November 17, 2017 10:06
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
@lukebigum lukebigum force-pushed the lukebigum-2.3.2-json branch 2 times, most recently from e0288e5 to 0ac4667 Compare November 17, 2017 15:26
@lukebigum
Copy link
Author

Definitely not safe to merge yet, there's a memory leak somewhere :-) I must be leaving Parson objects lying around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants