2017-09-28 02:02:35 +03:00
|
|
|
# We need this for the "cc-option" macro.
|
|
|
|
include ../../../scripts/Kbuild.include
|
|
|
|
|
tools/thermal: Introduce tmon, a tool for thermal subsystem
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.
As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.
To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.
TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-10-15 03:02:27 +04:00
|
|
|
VERSION = 1.0
|
|
|
|
|
|
|
|
BINDIR=usr/bin
|
|
|
|
WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int
|
2017-09-28 02:02:35 +03:00
|
|
|
CFLAGS+= -O1 ${WARNFLAGS}
|
|
|
|
# Add "-fstack-protector" only if toolchain supports it.
|
|
|
|
CFLAGS+= $(call cc-option,-fstack-protector)
|
2017-09-28 02:02:36 +03:00
|
|
|
CC?= $(CROSS_COMPILE)gcc
|
tools/thermal: Introduce tmon, a tool for thermal subsystem
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.
As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.
To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.
TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-10-15 03:02:27 +04:00
|
|
|
|
|
|
|
CFLAGS+=-D VERSION=\"$(VERSION)\"
|
|
|
|
LDFLAGS+=
|
|
|
|
TARGET=tmon
|
|
|
|
|
|
|
|
INSTALL_PROGRAM=install -m 755 -p
|
|
|
|
DEL_FILE=rm -f
|
|
|
|
|
2015-02-18 05:18:35 +03:00
|
|
|
# Static builds might require -ltinfo, for instance
|
|
|
|
ifneq ($(findstring -static, $(LDFLAGS)),)
|
|
|
|
STATIC := --static
|
|
|
|
endif
|
|
|
|
|
|
|
|
TMON_LIBS=-lm -lpthread
|
|
|
|
TMON_LIBS += $(shell pkg-config --libs $(STATIC) panelw ncursesw 2> /dev/null || \
|
|
|
|
pkg-config --libs $(STATIC) panel ncurses 2> /dev/null || \
|
|
|
|
echo -lpanel -lncurses)
|
tools/thermal: Introduce tmon, a tool for thermal subsystem
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.
As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.
To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.
TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-10-15 03:02:27 +04:00
|
|
|
|
2015-10-02 12:50:45 +03:00
|
|
|
CFLAGS += $(shell pkg-config --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
|
|
|
|
pkg-config --cflags $(STATIC) panel ncurses 2> /dev/null)
|
|
|
|
|
tools/thermal: Introduce tmon, a tool for thermal subsystem
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.
As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.
To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.
TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-10-15 03:02:27 +04:00
|
|
|
OBJS = tmon.o tui.o sysfs.o pid.o
|
|
|
|
OBJS +=
|
|
|
|
|
|
|
|
tmon: $(OBJS) Makefile tmon.h
|
2015-02-18 05:18:35 +03:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(TARGET) $(TMON_LIBS)
|
tools/thermal: Introduce tmon, a tool for thermal subsystem
Increasingly, Linux is running on thermally constrained devices. The simple
thermal relationship between processor and fan has become past for modern
computers.
As hardware vendors cope with the thermal constraints on their products,
more sensors are added, new cooling capabilities are introduced. The
complexity of the thermal relationship can grow exponentially among cooling
devices, zones, sensors, and trip points. They can also change dynamically.
To expose such relationship to the userspace, Linux generic thermal layer
introduced sysfs entry at /sys/class/thermal with a matrix of symbolic
links, trip point bindings, and device instances. To traverse such
matrix by hand is not a trivial task. Testing is also difficult in that
thermal conditions are often exception cases that hard to reach in
normal operations.
TMON is conceived as a tool to help visualize, tune, and test the
complex thermal subsystem.
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-10-15 03:02:27 +04:00
|
|
|
|
|
|
|
valgrind: tmon
|
|
|
|
sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null
|
|
|
|
|
|
|
|
install:
|
|
|
|
- mkdir -p $(INSTALL_ROOT)/$(BINDIR)
|
|
|
|
- $(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(DEL_FILE) "$(INSTALL_ROOT)/$(BINDIR)/$(TARGET)"
|
|
|
|
|
|
|
|
clean:
|
|
|
|
find . -name "*.o" | xargs $(DEL_FILE)
|
|
|
|
rm -f $(TARGET)
|
|
|
|
|
|
|
|
dist:
|
|
|
|
git tag v$(VERSION)
|
|
|
|
git archive --format=tar --prefix="$(TARGET)-$(VERSION)/" v$(VERSION) | \
|
|
|
|
gzip > $(TARGET)-$(VERSION).tar.gz
|