Menu

Tree [c171de] master /
 History

HTTPS access


File Date Author Commit
 .gitignore 2021-11-16 ssharunas ssharunas [c171de] Added packaging Makefile command
 COPYING 2009-09-28 ssharunas ssharunas [399fb7] added license file
 Changelog.txt 2021-11-16 jon jon [8108b1] Version 1.5.
 Makefile 2021-11-16 ssharunas ssharunas [c171de] Added packaging Makefile command
 README 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 communicator.c 2016-04-10 ssharunas ssharunas [762f7c] Fixed sigterm bug.
 communicator.h 2009-09-28 ssharunas ssharunas [d521d9] Updated headings, changed makefile
 config.c 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 config.h 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 greitukas.service 2021-11-16 jon jon [8108b1] Version 1.5.
 init.c 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 init.h 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 inputParser.c 2013-05-20 ssharunas ssharunas [3cc579] Implemented support for gvernor thresholds.
 inputParser.h 2013-05-20 ssharunas ssharunas [3cc579] Implemented support for gvernor thresholds.
 main.c 2016-04-10 ssharunas ssharunas [51b78f] Version 1.4
 outputFormater.c 2013-05-20 ssharunas ssharunas [3cc579] Implemented support for gvernor thresholds.
 outputFormater.h 2009-09-28 ssharunas ssharunas [d521d9] Updated headings, changed makefile
 stdtypes.h 2021-11-16 ssharunas ssharunas [c171de] Added packaging Makefile command
 system_io.c 2021-11-16 jon jon [8108b1] Version 1.5.
 system_io.h 2013-05-20 ssharunas ssharunas [3cc579] Implemented support for gvernor thresholds.

Read Me

-----------------------------
		About
-----------------------------

This deamon uses Linux kernel features to control cpus frequency.
It uses /sys/devices/system/cpu/ interface to retrieve and set current,
min, max frequencies and governors. It provides service to control
frequency via network using simple text protocol.


-----------------------------
		Installation
-----------------------------
	make
	sudo make install
done.

If your system is using systemd, you can additionally use
	sudo make install-systemd
This will add greitukas.service file to the /usr/lib/systemd/system. Greitukas
service can be enabled with
	systemctl enable greitukas

-----------------------------
		Configuration
-----------------------------

You can set initial commands to be executed at deamon startup. These commands are
stored in a file, separated with new lines.
You can specify what file to use with -c parameter, i.e.:
	greitukas -c /path/to/my/configuration/file

If you won't specify any file, file /etc/conf.d/greitukas will be used (if it exists).
Example of the file:
set governor all conservative
set downth conservative 50

-----------------------------
		Usage
-----------------------------

By default deamon listens ip address 127.0.0.1 on port 12345. You can connect
to using netcat (nc) or any similar tcp/ip program.
Once connected, type help to see full help list:

COMMUNICATION:
-------------------------------------------------------------------------------------------
|   Client               |   greitukas        | greitukas Error | human understans as
-------------------------------------------------------------------------------------------
|"what is your name?"    | "greitukas 1.0"    |                  | get program and version
|"who are you?"          |                    |                  |
|------------------------|--------------------|        -         |------------------------
|"version"               | "1.0"              |                  | get version
|------------------------|--------------------|------------------|------------------------
|"cpus"                  | "cpu0 cpu2"        | "none"           | get available cpus list
|"name cpus"             |                    |                  |
|------------------------|--------------------|------------------|------------------------
|"count"                 | "2"                |        -         | get available cpus count
|------------------------|--------------------|------------------|------------------------
|"governors cpuX"        |                    |                  |
|"name governors cpuX"   | "gov1 gov2"        |                  | get cpu supported governors list
|------------------------|--------------------|                  |------------------------
|"governor cpuX"         | "govX"             |                  | get current cpu governor
|------------------------|--------------------|                  |------------------------
|"speed cpuX"            |                    |                  |
|"frquency cpuX"         | "0000"             | "no such cpu"    | get current cpu frequency
|------------------------|--------------------|                  |------------------------
|"speeds cpuX"           | "0000 Hz, 0000 Hz" |                  | get supported cpu frequencies list
|"name speeds cpuX"      |                    |                  | with Hz addon
|------------------------|--------------------|                  |------------------------
|"frquencies cpuX"       | "0000 0000"        |                  | get supported cpu frequencies list
|"name frquencies cpuX"  |                    |                  | without Hz addon
|------------------------|--------------------|                  |------------------------
|"now cpuX"              | "0000 govX"        |                  | get current frequencyy and governor of cpu, separated by space
|------------------------|--------------------|                  |------------------------
|"max cpuX"              | "000"              |                  | get maximum frequency limit some governors respect that
|"min cpuX"              | "000"              |                  | get minimum frequency limit some governors respect that
|------------------------|--------------------|------------------|------------------------
|"upth govX"             | "90%"              |"no such governor"| get governor up threshold
|"downth govX"           | "10%"              |"not supported"   | get governor down threshold
|------------------------|--------------------|------------------|------------------------
|"set speed cpuX 000"    | "ok", "no such cpu", "could not set"  | set frequency for a cpu
|------------------------|                                       |------------------------
|"set governor cpuX gov" |                                       | set governor for a cpu
|------------------------|---------------------------------------|------------------------
|"set max cpuX 000"      | "ok", "no such cpu", "frequency is    | set maximum cpu speed
|------------------------| out of range", "ok, but governor does |------------------------
|"set min cpuX 000"      | not care about max/min freqency"      | set minimum cpu speed
|------------------------|---------------------------------------|------------------------
|"set upth govX 00"      | "ok", "no such governor", "not        | sets up/down threshold
|"set downth govX 00"    | supported", "invalid threashold"      | for governor
|------------------------|---------------------------------------|------------------------
|"help"                  | prints this table                     | get full help
|------------------------|---------------------------------------|------------------------
|"commands"              | print client commands                 | get command list
|"name commands          |                                       |
|------------------------|---------------------------------------|------------------------
|"exit"                  |                                       |disconnect from the deamon
|------------------------|                 -                     |------------------------
|"down"                  |                                       |shutdown deamon
-------------------------------------------------------------------------------------------

If you are trying to set speed using "set speed", governor is automatically changed to userspace. If it is impossiable
to change governor (kernel module is not loaded or somthing else), setting speed fails.

All comands, accepting cpuX can accept any existent cpu with number e.g cpu0 or command may be aplied to all cpus
by passing parameter 'all', e.g. 'now all'.

example commands:
	cpus
	speeds cpu0
	set speed all 800000

-----------------------------
		Queries
-----------------------------
Commands may be only alphanumeric characters.
Deamon receives characters one by one, until end of command char is received (\n or \0).


Format for sending commands should be as follows:
	{some command}{[\n][\0]}
list of commands is specified above. A command should be end with a new line or with a null character.
Both characters may be used. In that case, one of them will be ignored (the second).
e.g. if you want to get list of cpus you should send:
	write(socket, "cpus\n", strlen("cpus\n"));

Format for deamon responses are:
	{some response}{\n\0}
Deamon always sends both: newline and null characters.
List of response examples is shown above, in the table.

-----------------------------
		If it doesn't work
-----------------------------

First of all you should check if your cpu or kernel has support for frequency scalling.
You should also check if right kernel modules are loaded. acpi_cpufreq, p4-clockmod or
speedstep-ich should be  loaded for intel, powernow-k# for AMD.
  You may also have to modprobe governors: cpufreq_ondemand, cpufreq_powersave, cpufreq_conservative,
cpufreq_powersave.
  If you want to set specific frequency, you need userspace governor.

-----------------------------
		Author
-----------------------------
Author of the program is:
Šarūnas Gliebus
	ssharunas@yahoo.co.uk