-
Notifications
You must be signed in to change notification settings - Fork 45
add cpuexporter example #327
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
base: master
Are you sure you want to change the base?
Conversation
ab72360 to
6bfe199
Compare
eef073b to
dc9abc9
Compare
7fc2b58 to
88999fd
Compare
26dbd1a to
830856a
Compare
| local int_part = (value * 100) // total | ||
| local remainder = (value * 100) % total | ||
| local frac_high = (remainder * 100000000) // total | ||
| local remainder2 = (remainder * 100000000) % total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remainder_{high, low}?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I don't overflow 64bit integer and get a 16 decimals precision, I split the operation in two parts (high, low).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't you have enough precision using difftime?
| local frac_high = (remainder * 100000000) // total | ||
| local remainder2 = (remainder * 100000000) % total | ||
| local frac_low = (remainder2 * 100000000) // total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, it's not clear to me why we need to do this twice.. I would move the common pattern to a function anyway..
4569e43 to
7933e11
Compare
Basing on top of lneto_unixsock branch since I need it for longer filename.
I'm still planning to test it a little more comparing with other cpu collectors like telegraf and fluent-bit to make sure my measurements are correct.
I'm asking for review anyway since I need feedback on code quality and style, since I'm not Lua fluent yet.