Skip to content

Conversation

@endersonmaia
Copy link
Contributor

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.

@endersonmaia endersonmaia requested a review from lneto November 26, 2025 00:42
@lneto lneto force-pushed the lneto_unixsock branch 3 times, most recently from ab72360 to 6bfe199 Compare November 26, 2025 12:50
@endersonmaia endersonmaia force-pushed the endersonmaia_cpuexporter branch from eef073b to dc9abc9 Compare November 26, 2025 17:54
@endersonmaia endersonmaia changed the base branch from lneto_unixsock to master November 26, 2025 17:56
@endersonmaia endersonmaia force-pushed the endersonmaia_cpuexporter branch from 7fc2b58 to 88999fd Compare November 26, 2025 22:57
@endersonmaia endersonmaia marked this pull request as ready for review November 26, 2025 22:57
@endersonmaia endersonmaia requested a review from lneto November 26, 2025 22:57
@endersonmaia endersonmaia force-pushed the endersonmaia_cpuexporter branch from 26dbd1a to 830856a Compare November 28, 2025 17:24
@endersonmaia endersonmaia requested a review from lneto November 28, 2025 17:29
local int_part = (value * 100) // total
local remainder = (value * 100) % total
local frac_high = (remainder * 100000000) // total
local remainder2 = (remainder * 100000000) % total
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remainder_{high, low}?

Copy link
Contributor Author

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).

Copy link
Contributor

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?

Comment on lines +30 to +32
local frac_high = (remainder * 100000000) // total
local remainder2 = (remainder * 100000000) % total
local frac_low = (remainder2 * 100000000) // total
Copy link
Contributor

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..

@endersonmaia endersonmaia force-pushed the endersonmaia_cpuexporter branch from 4569e43 to 7933e11 Compare December 1, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants