Coder Social home page Coder Social logo

userHz is hard-coded to 100 about procfs HOT 10 OPEN

prometheus avatar prometheus commented on May 13, 2024
userHz is hard-coded to 100

from procfs.

Comments (10)

mdlayher avatar mdlayher commented on May 13, 2024 1

We could probably generate the constant in x/sys/Unix and then not worry about it. Easier to push it upstream since the build infrastructure is there.

from procfs.

brian-brazil avatar brian-brazil commented on May 13, 2024

(And yes, I know that procfs did originally query for the value, but it was replaced with a constant for "reasons")

When this was last looked at, all supported platforms used 100.

from procfs.

SuperQ avatar SuperQ commented on May 13, 2024

The node_exporter was not designed to run in containers, it is a host system level tool.

from procfs.

grobie avatar grobie commented on May 13, 2024

So we removed it as the necessary cgo dependency forced too much overhead in crossbuilds. Could we come up with a simple solution here, like defining the constant in per architecture files and use build flags?

from procfs.

zegelin avatar zegelin commented on May 13, 2024

@SuperQ LX zones should be considered to be similar to full VMs rather than linux containers. We're not talking about LXC or Docker here.

from procfs.

brian-brazil avatar brian-brazil commented on May 13, 2024

Could we come up with a simple solution here, like defining the constant in per architecture files and use build flags?

The setup here is sufficiently weird that the setting may not be the one we expect for the architecture.

Which architecture is this?

from procfs.

grobie avatar grobie commented on May 13, 2024

I should have said per operating system files. It seems SmartOS will just be recognized as Solaris in golang, and I don't know whether all Solaris variants use USER_HZ=1000.

We could re-introduce C code for the syscall in something like user_hz_solaris.go and continue to use the hardcoded value in user_hz.go.

@zegelin Do you know how to query for the USER_HZ value in solaris?

from procfs.

brian-brazil avatar brian-brazil commented on May 13, 2024

USER_HZ is a Linux thing, Solaris doesn't have it.

from procfs.

grobie avatar grobie commented on May 13, 2024

Oh, now I see the issue I guess. From the perspective of the program running in the LX zone, the OS will be Linux.

I'm very hesitant of introducing a C dependency just for that exception. @zegelin Does LX provide any hint about the environment we could query for without a systemcall?

from procfs.

zegelin avatar zegelin commented on May 13, 2024

@brian-brazil

Which architecture is this?

x86_64

@grobie
Exactly. Processes running in a LX zone think they are running on Linux even though the host is actually Solaris.

Does LX provide any hint about the environment we could query for without a systemcall?

There is a sysctl that returns:
kernel.osrelease = BrandZ virtual linux

LX emulates /proc:

# cat /proc/sys/kernel/osrelease 
BrandZ virtual linux

from procfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.