Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828443 - sys-apps/corefreq monitoring CPU frequency, C-states thermals and voltages (New Package)
Summary: sys-apps/corefreq monitoring CPU frequency, C-states thermals and voltages (N...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: Default Assignee for New Packages
URL:
Whiteboard:
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2021-12-06 02:27 UTC by Xian Wang
Modified: 2024-02-28 17:32 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild file (corefreq-1.88.4.ebuild,1.25 KB, text/plain)
2021-12-06 02:27 UTC, Xian Wang
Details
Makefile patch (installation-convention.patch,420 bytes, patch)
2021-12-06 02:27 UTC, Xian Wang
Details | Diff
init script (corefreqd,236 bytes, text/plain)
2021-12-06 02:27 UTC, Xian Wang
Details
ebuild file (corefreq-1.88.4.ebuild,1.25 KB, text/plain)
2021-12-09 06:41 UTC, Xian Wang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xian Wang 2021-12-06 02:27:03 UTC
Created attachment 757534 [details]
ebuild file

Please find attached corefreq-1.88.4.ebuild, a patch, and an init script for the CoreFreq CPU monitoring software.

CoreFreq is a CPU monitoring software designed for the 64-bits Processors. It allows monitoring CPU frequency, C-states thermals and voltages etc.

I suggest sys-process/corefreq. The build and runtime dependencies are taken from the official README at https://github.com/cyring/CoreFreq.
Comment 1 Xian Wang 2021-12-06 02:27:31 UTC
Created attachment 757535 [details, diff]
Makefile patch
Comment 2 Xian Wang 2021-12-06 02:27:46 UTC
Created attachment 757536 [details]
init script
Comment 3 Xian Wang 2021-12-09 06:41:58 UTC
Created attachment 757776 [details]
ebuild file

Fixes what to call the init script. It was package name, but the daemon is called corefreqd in the code
Comment 4 Vitaly Zdanevich 2023-05-30 12:22:21 UTC
Why not exists now?
Comment 5 Vitaly Zdanevich 2023-05-30 12:27:13 UTC
Oh, looks like it never was merged :(
Comment 6 Vitaly Zdanevich 2023-05-30 12:55:44 UTC
I add it here https://github.com/gentoo/guru/commit/11a9dd7c240a290cb026a4190555939db337f88e

But currently cannot install, I have this error:

```
# emerge -a sys-apps/corefreq

These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 2.19 s.

[ebuild  N    ~] sys-apps/corefreq-1.96.1  USE="-dist-kernel" 

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-apps/corefreq-1.96.1::guru
 * corefreq-1.96.1.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                      [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     6.1.12-gentoo+
 * Checking for kernel configurations...
 * Enable optional configurations only as you see fit.
 * Not all optional configurations will be suitable for your system.
 * Build will fail for required configs.
 * The other configs are all optional configs.
 * Checking for suitable kernel configuration options ...
 *   CONFIG_XEN:	is not set when it should be.
 *   CONFIG_SCHED_MUQSS:	is not set when it should be.
 *   CONFIG_SCHED_BMQ:	is not set when it should be.
 *   CONFIG_SCHED_PDS:	is not set when it should be.                                                                                                                                                                                                                     [ !! ]
 * Please check to make sure these options are set correctly.
 * Failure to do so may cause unexpected problems.
>>> Unpacking source...
>>> Unpacking corefreq-1.96.1.tar.gz to /var/tmp/portage/sys-apps/corefreq-1.96.1/work
>>> Source unpacked in /var/tmp/portage/sys-apps/corefreq-1.96.1/work
>>> Preparing source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing corefreqk module
make -j8 HOSTCC=x86_64-pc-linux-gnu-gcc 'LDFLAGS=-m elf_x86_64' clean all 
rm -f corefreqd corefreq-cli
cc  -Wall -Wfatal-errors -pthread -c corefreqd.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd.o
cc  -Wall -Wfatal-errors -c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqm.o
cc  -Wall -Wfatal-errors -c corefreq-cli.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli.o
make -j1 -C /lib/modules/6.1.12-gentoo+/build M=/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 clean
cc  -Wall -Wfatal-errors -c corefreq-ui.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-ui.o
cc  -Wall -Wfatal-errors -c corefreq-cli-rsc.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli-rsc.o
cc  -Wall -Wfatal-errors -c corefreq-cli-json.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-json.o
cc  -Wall -Wfatal-errors -c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-extra.o
make[1]: Entering directory '/usr/src/linux-6.1.12-gentoo'
make[1]: warning: -j1 forced in submake: resetting jobserver mode.
make[1]: Leaving directory '/usr/src/linux-6.1.12-gentoo'
cc  -Wall -Wfatal-errors corefreqd.c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd -lpthread -lm -lrt
cc  -Wall -Wfatal-errors \
  corefreq-cli.c corefreq-ui.c corefreq-cli-rsc.c \
  corefreq-cli-json.c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli -lm -lrt
make -j1 -C /lib/modules/6.1.12-gentoo+/build M=/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 modules
make[1]: Entering directory '/usr/src/linux-6.1.12-gentoo'
make[1]: warning: -j1 forced in submake: resetting jobserver mode.
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Gentoo 12.2.1_p20230121-r1 p10) 12.2.1 20230121
  You are using:           x86_64-pc-linux-gnu-gcc (Gentoo 12.2.1_p20230428-r1 p2) 12.2.1 20230428
/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.c: In function ‘For_All_ACPI_CPPC’:
/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.c:4178:25: error: implicit declaration of function ‘acpi_cpc_valid’ [-Werror=implicit-function-declaration]
 4178 |         signed int rc = acpi_cpc_valid() == false;
      |                         ^~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.o] Error 1
make[1]: *** [Makefile:2005: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1] Error 2
make[1]: Leaving directory '/usr/src/linux-6.1.12-gentoo'
make: *** [Makefile:86: all] Error 2
 * ERROR: sys-apps/corefreq-1.96.1::guru failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-apps/corefreq-1.96.1::guru'`,
 * the complete build log and the output of `emerge -pqv '=sys-apps/corefreq-1.96.1::guru'`.
 * The complete build log is located at '/var/tmp/portage/sys-apps/corefreq-1.96.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-apps/corefreq-1.96.1/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1'
 * S: '/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1'

>>> Failed to emerge sys-apps/corefreq-1.96.1, Log file:
```

Have no time now to investigate :(
Comment 7 Vitaly Zdanevich 2023-05-31 06:02:26 UTC
Solved that issue on the upstream, copied to GURU https://github.com/gentoo/guru/tree/master/sys-apps/corefreq
Comment 8 Vitaly Zdanevich 2023-05-31 06:13:58 UTC
Currently I have a compilation problem with it:

"No rule to make target 'arch/amd64/Makefile"

Any ideas?
Comment 9 steve_v 2023-05-31 11:09:19 UTC
^ Likewise.

FWIW I've been using the following fairly simple ebuild in my localrepo for some time. I just bumped it to 1.96.1 and still builds fine.

---
EAPI=7

inherit autotools linux-info linux-mod systemd

DESCRIPTION="CoreFreq is a CPU monitoring software designed for the 64-bits Processors."
HOMEPAGE="https://github.com/cyring/CoreFreq"
LICENSE="GPL-2"

#    EGIT_REPO_URI="https://github.com/cyring/CoreFreq.git"

if [ "${PV}" = "9999" ]; then
        EGIT_REPO_URI="https://github.com/cyring/${PN}.git"
        inherit git-r3
else
        SRC_URI="https://github.com/cyring/${PN}/archive/$PV.tar.gz -> $P.tar.gz"
        S="${WORKDIR}/CoreFreq-${PV}"
        KEYWORDS="~amd64 ~x86"
fi

IUSE="doc systemd"
SLOT="0"

DEPEND="sys-devel/make
        kernel_linux? ( virtual/linux-sources )"
RDEPEND="${DEPEND}"
BDEPEND=""

BUILD_TARGETS="all"
MODULE_NAMES="corefreqk(misc:${S})"
MODULESD_COREFREQK_ENABLED="yes"

pkg_setup() {
        get_version
        require_configured_kernel
        BUILD_PARAMS="KERNELDIR=/lib/modules/${KV_FULL}/build"
        linux-mod_pkg_setup
}

src_install() {
    linux-mod_src_install
    dobin corefreqd corefreq-cli
    newconfd "${FILESDIR}/${PN}.conf" "${PN}"
    doinitd "${FILESDIR}/${PN}"
    use systemd && systemd_dounit ${PN}.service
    use doc && dodoc README.md
}
---
Comment 10 Vitaly Zdanevich 2023-05-31 12:03:05 UTC
Thanks, but I got error

> /var/tmp/portage/sys-apps/corefreq-1.96.2/files/corefreq.conf does not exist
Comment 11 steve_v 2023-05-31 17:05:54 UTC
Yeah, that was really just for comparison to the ebuild in guru, so I didn't include the init script or config file. Both are optional and trivial.

files/corefreq.conf:
# Default settings for /etc/init.d/corefreq.

# Options to pass to corefreqd
COREFREQD_ARGS="-q"

files/corefreq:
#!/sbin/openrc-run
name=corefreq
command=/usr/bin/corefreqd
command_args=${COREFREQD_ARGS}
command_background=1
pidfile=/run/corefreqd.pid
Comment 12 Vitaly Zdanevich 2023-05-31 18:33:36 UTC
Thanks, emerging is successful now, but error on starting the cli:

```
# corefreq-cli 
Daemon connection error code 2
corefreq-ro-shm: 'No such file or directory' @ line 21337
```
Comment 13 Vitaly Zdanevich 2023-05-31 18:34:43 UTC
Addition to the previous comment - I am with OpenRC.
Comment 14 Vitaly Zdanevich 2023-05-31 18:35:45 UTC
And error on starting corefreqd:

```
# corefreqd
Driver connection error code 2
/dev/corefreqk: 'No such file or directory' @ line 9245
```
Comment 15 steve_v 2023-05-31 20:18:20 UTC
Insert the corefreqk kernel module first.
Might be worth printing an einfo reminder to add it to /etc/conf.d/modules, or shipping an /etc/modules-load.d/corefreq.conf so it works OOTB. 
Like I said that ebuild wasn't really meant for general consumption, so it's probably missing other details as well. 

I don't have commit access to guru to fix any of this, I assumed since you added it there, you were up for making sure it worked.
Comment 16 Vitaly Zdanevich 2023-05-31 20:43:30 UTC
I am not an expert in this, not sure what to do :(

Please provide the updated ebuild, current version is here https://github.com/gentoo/guru/tree/dev/sys-apps/corefreq
Comment 17 steve_v 2023-05-31 21:17:31 UTC
Personally I prefer to configure module loading by hand, which is why I didn't include it. Up to you which way you want to go.
Otherwise, that ebuild looks fine to me. I don't know anything about style standards an such for guru though. vOv
Comment 18 Vitaly Zdanevich 2023-06-01 05:08:55 UTC
Ok, thanks, it works after:

modprobe corefreqk
corefreqd
corefreq-cli

I will add a message about it after ebuild emerge.
Comment 19 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-01 05:25:27 UTC
(In reply to Vitaly Zdanevich from comment #16)
> I am not an expert in this, not sure what to do :(
> 
> Please provide the updated ebuild, current version is here
> https://github.com/gentoo/guru/tree/dev/sys-apps/corefreq

Please don't commit ebuilds without testing them. If you need help, ask for help before committing them.
Comment 20 Vitaly Zdanevich 2023-06-01 06:44:09 UTC
Ok, thanks
Comment 21 Vitaly Zdanevich 2024-02-28 17:32:24 UTC
I got a message https://bugs.gentoo.org/908946 that I need to migrate it from linux-mod to linux-mod-r1. I am trying, this is my current state:

```
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit linux-mod-r1 systemd

DESCRIPTION="CPU monitoring software designed for the 64-bits Processors, like top"
HOMEPAGE="https://www.cyring.fr/"
SRC_URI="https://github.com/cyring/$PN/archive/$PV.tar.gz -> $P.tar.gz"
S="${WORKDIR}/CoreFreq-${PV}"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-* ~amd64"

IUSE="doc systemd"

DEPEND="dev-build/make
	kernel_linux? ( virtual/linux-sources )"

BDEPEND="sys-devel/gcc
	dev-build/make
	dev-vcs/git"

RDEPEND="sys-libs/glibc"

CONFIG_CHECK="SMP X86_MSR ~HOTPLUG_CPU ~CPU_IDLE ~CPU_FREQ ~PM_SLEEP ~DMI ~XEN ~AMD_NB ~HAVE_PERF_EVENTS ~SCHED_MUQSS ~SCHED_BMQ ~SCHED_PDS"

MODULESD_COREFREQK_ENABLED="yes"

pkg_setup() {
	get_version
	require_configured_kernel
	linux-mod-r1_pkg_setup
}

QA_FLAGS_IGNORED="usr/bin/.*"

src_compile() {
	local modlist=( corefreqk=misc:"${S}" )
	local modargs=( "KERNELDIR=${KV_OUT_DIR}" )
}

src_install() {
	linux-mod-r1_src_install
	dobin corefreqd corefreq-cli
	newconfd "${FILESDIR}/${PN}.conf" "${PN}"
	doinitd "${FILESDIR}/${PN}"
	use systemd && systemd_dounit ${PN}d.service
	use doc && dodoc README.md
}

pkg_postinst() {
	einfo "To be able to use corefreq, you need to load kernel module:"
	einfo "modprobe corefreqk"
	einfo "After that - start daemon with corefreqd"
	einfo "or by `rc-service corefreq start`"
	einfo "And only after that you can start corefreq-cli"
}
```

Current error:

    MODULESD_* variables are no longer supported, replace by handcrafted .conf files if needed

I do not know, what to do with that?