Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c036588 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull cpupower updates from Dominik Brodowski.

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpupowerutils:
  cpupower tools: add install target to the debug tools' makefiles
  cpupower tools: allow to build debug tools in a separate directory too
  cpupower: Fix broken mask values
  cpupower tool: allow to build in a separate directory
  cpupower tool: makefile: simplify the recipe used to generate cpupower.pot target
  cpupower tool: remove use of undefined variables from the clean target of the top makefile
  cpupower: Fix linking with --as-needed
  cpupower: Remove unneeded code and by that fix a memleak
  cpupower: Fix number of idle states
  cpupower: Unify cpupower-frequency-* manpages
  cpupower: Add cpupower-idle-info manpage
  cpupower: AMD fam14h/Ontario monitor can also be used by fam12h cpus
  cpupower: Better interface for accessing AMD pci registers
parents a6f707b6 f1660338
Loading
Loading
Loading
Loading
+57 −36
Original line number Original line Diff line number Diff line
@@ -19,6 +19,16 @@
# along with this program; if not, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
OUTPUT=./
ifeq ("$(origin O)", "command line")
	OUTPUT := $(O)/
endif

ifneq ($(OUTPUT),)
# check that the output directory actually exists
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif


# --- CONFIGURATION BEGIN ---
# --- CONFIGURATION BEGIN ---


@@ -87,6 +97,7 @@ AR = $(CROSS)ar
STRIP = $(CROSS)strip
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib
RANLIB = $(CROSS)ranlib
HOSTCC = gcc
HOSTCC = gcc
MKDIR = mkdir




# Now we set up the build system
# Now we set up the build system
@@ -95,7 +106,7 @@ HOSTCC = gcc
# set up PWD so that older versions of make will work with our build.
# set up PWD so that older versions of make will work with our build.
PWD = $(shell pwd)
PWD = $(shell pwd)


GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo po/$$HLANG.gmo; done;}
GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo $(OUTPUT)po/$$HLANG.gmo; done;}


export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS
export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS


@@ -122,15 +133,18 @@ UTIL_OBJS = utils/helpers/amd.o utils/helpers/topology.o utils/helpers/msr.o \
	utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \
	utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \
	utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o
	utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o


UTIL_SRC := $(UTIL_OBJS:.o=.c)

UTIL_OBJS := $(addprefix $(OUTPUT),$(UTIL_OBJS))

UTIL_HEADERS = utils/helpers/helpers.h utils/idle_monitor/cpupower-monitor.h \
UTIL_HEADERS = utils/helpers/helpers.h utils/idle_monitor/cpupower-monitor.h \
	utils/helpers/bitmask.h \
	utils/helpers/bitmask.h \
	utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def
	utils/idle_monitor/idle_monitors.h utils/idle_monitor/idle_monitors.def


UTIL_SRC := $(UTIL_OBJS:.o=.c)

LIB_HEADERS = 	lib/cpufreq.h lib/sysfs.h
LIB_HEADERS = 	lib/cpufreq.h lib/sysfs.h
LIB_SRC = 	lib/cpufreq.c lib/sysfs.c
LIB_SRC = 	lib/cpufreq.c lib/sysfs.c
LIB_OBJS = 	lib/cpufreq.o lib/sysfs.o
LIB_OBJS = 	lib/cpufreq.o lib/sysfs.o
LIB_OBJS :=	$(addprefix $(OUTPUT),$(LIB_OBJS))


CFLAGS +=	-pipe
CFLAGS +=	-pipe


@@ -168,83 +182,90 @@ endif


# the actual make rules
# the actual make rules


all: libcpupower cpupower $(COMPILE_NLS) $(COMPILE_BENCH)
all: libcpupower $(OUTPUT)cpupower $(COMPILE_NLS) $(COMPILE_BENCH)


lib/%.o: $(LIB_SRC) $(LIB_HEADERS)
$(OUTPUT)lib/%.o: $(LIB_SRC) $(LIB_HEADERS)
	$(ECHO) "  CC      " $@
	$(ECHO) "  CC      " $@
	$(QUIET) $(CC) $(CFLAGS) -fPIC -o $@ -c lib/$*.c
	$(QUIET) $(CC) $(CFLAGS) -fPIC -o $@ -c lib/$*.c


libcpupower.so.$(LIB_MAJ): $(LIB_OBJS)
$(OUTPUT)libcpupower.so.$(LIB_MAJ): $(LIB_OBJS)
	$(ECHO) "  LD      " $@
	$(ECHO) "  LD      " $@
	$(QUIET) $(CC) -shared $(CFLAGS) $(LDFLAGS) -o $@ \
	$(QUIET) $(CC) -shared $(CFLAGS) $(LDFLAGS) -o $@ \
		-Wl,-soname,libcpupower.so.$(LIB_MIN) $(LIB_OBJS)
		-Wl,-soname,libcpupower.so.$(LIB_MIN) $(LIB_OBJS)
	@ln -sf $@ libcpupower.so
	@ln -sf $(@F) $(OUTPUT)libcpupower.so
	@ln -sf $@ libcpupower.so.$(LIB_MIN)
	@ln -sf $(@F) $(OUTPUT)libcpupower.so.$(LIB_MIN)


libcpupower: libcpupower.so.$(LIB_MAJ)
libcpupower: $(OUTPUT)libcpupower.so.$(LIB_MAJ)


# Let all .o files depend on its .c file and all headers
# Let all .o files depend on its .c file and all headers
# Might be worth to put this into utils/Makefile at some point of time
# Might be worth to put this into utils/Makefile at some point of time
$(UTIL_OBJS): $(UTIL_HEADERS)
$(UTIL_OBJS): $(UTIL_HEADERS)


.c.o:
$(OUTPUT)%.o: %.c
	$(ECHO) "  CC      " $@
	$(ECHO) "  CC      " $@
	$(QUIET) $(CC) $(CFLAGS) -I./lib -I ./utils -o $@ -c $*.c
	$(QUIET) $(CC) $(CFLAGS) -I./lib -I ./utils -o $@ -c $*.c


cpupower: $(UTIL_OBJS) libcpupower.so.$(LIB_MAJ)
$(OUTPUT)cpupower: $(UTIL_OBJS) $(OUTPUT)libcpupower.so.$(LIB_MAJ)
	$(ECHO) "  CC      " $@
	$(ECHO) "  CC      " $@
	$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) -lcpupower -lrt -lpci -L. -o $@ $(UTIL_OBJS)
	$(QUIET) $(CC) $(CFLAGS) $(LDFLAGS) $(UTIL_OBJS) -lcpupower -lrt -lpci -L$(OUTPUT) -o $@
	$(QUIET) $(STRIPCMD) $@
	$(QUIET) $(STRIPCMD) $@


po/$(PACKAGE).pot: $(UTIL_SRC)
$(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
	$(ECHO) "  GETTEXT " $@
	$(ECHO) "  GETTEXT " $@
	$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
	$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
		--keyword=_ --keyword=N_ $(UTIL_SRC) && \
		--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
	test -f $(PACKAGE).po && \
	mv -f $(PACKAGE).po po/$(PACKAGE).pot


po/%.gmo: po/%.po
$(OUTPUT)po/%.gmo: po/%.po
	$(ECHO) "  MSGFMT  " $@
	$(ECHO) "  MSGFMT  " $@
	$(QUIET) msgfmt -o $@ po/$*.po
	$(QUIET) msgfmt -o $@ po/$*.po


create-gmo: ${GMO_FILES}
create-gmo: ${GMO_FILES}


update-po: po/$(PACKAGE).pot
update-po: $(OUTPUT)po/$(PACKAGE).pot
	$(ECHO) "  MSGMRG  " $@
	$(ECHO) "  MSGMRG  " $@
	$(QUIET) @for HLANG in $(LANGUAGES); do \
	$(QUIET) @for HLANG in $(LANGUAGES); do \
		echo -n "Updating $$HLANG "; \
		echo -n "Updating $$HLANG "; \
		if msgmerge po/$$HLANG.po po/$(PACKAGE).pot -o \
		if msgmerge po/$$HLANG.po $< -o \
		   po/$$HLANG.new.po; then \
		   $(OUTPUT)po/$$HLANG.new.po; then \
			mv -f po/$$HLANG.new.po po/$$HLANG.po; \
			mv -f $(OUTPUT)po/$$HLANG.new.po $(OUTPUT)po/$$HLANG.po; \
		else \
		else \
			echo "msgmerge for $$HLANG failed!"; \
			echo "msgmerge for $$HLANG failed!"; \
			rm -f po/$$HLANG.new.po; \
			rm -f $(OUTPUT)po/$$HLANG.new.po; \
		fi; \
		fi; \
	done;
	done;


compile-bench: libcpupower.so.$(LIB_MAJ)
compile-bench: $(OUTPUT)libcpupower.so.$(LIB_MAJ)
	@V=$(V) confdir=$(confdir) $(MAKE) -C bench
	@V=$(V) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT)

# we compile into subdirectories. if the target directory is not the
# source directory, they might not exists. So we depend the various
# files onto their directories.
DIRECTORY_DEPS = $(LIB_OBJS) $(UTIL_OBJS) $(GMO_FILES)
$(DIRECTORY_DEPS): | $(sort $(dir $(DIRECTORY_DEPS)))

# In the second step, we make a rule to actually create these directories
$(sort $(dir $(DIRECTORY_DEPS))):
	$(ECHO) "  MKDIR      " $@
	$(QUIET) $(MKDIR) -p $@ 2>/dev/null


clean:
clean:
	-find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
	-find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
	 | xargs rm -f
	 | xargs rm -f
	-rm -f $(UTIL_BINS)
	-rm -f $(OUTPUT)cpupower
	-rm -f $(IDLE_OBJS)
	-rm -f $(OUTPUT)libcpupower.so*
	-rm -f cpupower
	-rm -rf $(OUTPUT)po/*.{gmo,pot}
	-rm -f libcpupower.so*
	$(MAKE) -C bench O=$(OUTPUT) clean
	-rm -rf po/*.gmo po/*.pot
	$(MAKE) -C bench clean




install-lib:
install-lib:
	$(INSTALL) -d $(DESTDIR)${libdir}
	$(INSTALL) -d $(DESTDIR)${libdir}
	$(CP) libcpupower.so* $(DESTDIR)${libdir}/
	$(CP) $(OUTPUT)libcpupower.so* $(DESTDIR)${libdir}/
	$(INSTALL) -d $(DESTDIR)${includedir}
	$(INSTALL) -d $(DESTDIR)${includedir}
	$(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h
	$(INSTALL_DATA) lib/cpufreq.h $(DESTDIR)${includedir}/cpufreq.h


install-tools:
install-tools:
	$(INSTALL) -d $(DESTDIR)${bindir}
	$(INSTALL) -d $(DESTDIR)${bindir}
	$(INSTALL_PROGRAM) cpupower $(DESTDIR)${bindir}
	$(INSTALL_PROGRAM) $(OUTPUT)cpupower $(DESTDIR)${bindir}


install-man:
install-man:
	$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
	$(INSTALL_DATA) -D man/cpupower.1 $(DESTDIR)${mandir}/man1/cpupower.1
@@ -257,13 +278,13 @@ install-man:
install-gmo:
install-gmo:
	$(INSTALL) -d $(DESTDIR)${localedir}
	$(INSTALL) -d $(DESTDIR)${localedir}
	for HLANG in $(LANGUAGES); do \
	for HLANG in $(LANGUAGES); do \
		echo '$(INSTALL_DATA) -D po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo'; \
		echo '$(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo'; \
		$(INSTALL_DATA) -D po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
		$(INSTALL_DATA) -D $(OUTPUT)po/$$HLANG.gmo $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupower.mo; \
	done;
	done;


install-bench:
install-bench:
	@#DESTDIR must be set from outside to survive
	@#DESTDIR must be set from outside to survive
	@sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench install
	@sbindir=$(sbindir) bindir=$(bindir) docdir=$(docdir) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT) install


install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)
install: all install-lib install-tools install-man $(INSTALL_NLS) $(INSTALL_BENCH)


+15 −8
Original line number Original line Diff line number Diff line
LIBS = -L../ -lm -lcpupower
OUTPUT := ./
ifeq ("$(origin O)", "command line")
ifneq ($(O),)
	OUTPUT := $(O)/
endif
endif


OBJS = main.o parse.o system.o benchmark.o
LIBS = -L../ -L$(OUTPUT) -lm -lcpupower

OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"
CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"


%.o : %.c
$(OUTPUT)%.o : %.c
	$(ECHO) "  CC      " $@
	$(ECHO) "  CC      " $@
	$(QUIET) $(CC) -c $(CFLAGS) $< -o $@
	$(QUIET) $(CC) -c $(CFLAGS) $< -o $@


cpufreq-bench: $(OBJS)
$(OUTPUT)cpufreq-bench: $(OBJS)
	$(ECHO) "  CC      " $@
	$(ECHO) "  CC      " $@
	$(QUIET) $(CC) -o $@ $(CFLAGS) $(OBJS) $(LIBS)
	$(QUIET) $(CC) -o $@ $(CFLAGS) $(OBJS) $(LIBS)


all: cpufreq-bench
all: $(OUTPUT)cpufreq-bench


install:
install:
	mkdir -p $(DESTDIR)/$(sbindir)
	mkdir -p $(DESTDIR)/$(sbindir)
	mkdir -p $(DESTDIR)/$(bindir)
	mkdir -p $(DESTDIR)/$(bindir)
	mkdir -p $(DESTDIR)/$(docdir)
	mkdir -p $(DESTDIR)/$(docdir)
	mkdir -p $(DESTDIR)/$(confdir)
	mkdir -p $(DESTDIR)/$(confdir)
	install -m 755 cpufreq-bench $(DESTDIR)/$(sbindir)/cpufreq-bench
	install -m 755 $(OUTPUT)cpufreq-bench $(DESTDIR)/$(sbindir)/cpufreq-bench
	install -m 755 cpufreq-bench_plot.sh $(DESTDIR)/$(bindir)/cpufreq-bench_plot.sh
	install -m 755 cpufreq-bench_plot.sh $(DESTDIR)/$(bindir)/cpufreq-bench_plot.sh
	install -m 644 README-BENCH $(DESTDIR)/$(docdir)/README-BENCH
	install -m 644 README-BENCH $(DESTDIR)/$(docdir)/README-BENCH
	install -m 755 cpufreq-bench_script.sh $(DESTDIR)/$(docdir)/cpufreq-bench_script.sh
	install -m 755 cpufreq-bench_script.sh $(DESTDIR)/$(docdir)/cpufreq-bench_script.sh
	install -m 644 example.cfg $(DESTDIR)/$(confdir)/cpufreq-bench.conf
	install -m 644 example.cfg $(DESTDIR)/$(confdir)/cpufreq-bench.conf


clean:
clean:
	rm -f *.o
	rm -f $(OUTPUT)*.o
	rm -f cpufreq-bench
	rm -f $(OUTPUT)cpufreq-bench
+29 −11
Original line number Original line Diff line number Diff line
OUTPUT=./
ifeq ("$(origin O)", "command line")
	OUTPUT := $(O)/
endif

DESTDIR =
bindir  = /usr/bin

INSTALL = /usr/bin/install


default: all
default: all


centrino-decode: centrino-decode.c
$(OUTPUT)centrino-decode: centrino-decode.c
	$(CC) $(CFLAGS) -o centrino-decode centrino-decode.c
	$(CC) $(CFLAGS) -o $@ centrino-decode.c


dump_psb: dump_psb.c
$(OUTPUT)dump_psb: dump_psb.c
	$(CC) $(CFLAGS) -o dump_psb dump_psb.c
	$(CC) $(CFLAGS) -o $@ dump_psb.c


intel_gsic: intel_gsic.c
$(OUTPUT)intel_gsic: intel_gsic.c
	$(CC) $(CFLAGS) -o intel_gsic -llrmi intel_gsic.c
	$(CC) $(CFLAGS) -o $@ -llrmi intel_gsic.c


powernow-k8-decode: powernow-k8-decode.c
$(OUTPUT)powernow-k8-decode: powernow-k8-decode.c
	$(CC) $(CFLAGS) -o powernow-k8-decode powernow-k8-decode.c
	$(CC) $(CFLAGS) -o $@ powernow-k8-decode.c


all: centrino-decode dump_psb intel_gsic powernow-k8-decode
all: $(OUTPUT)centrino-decode $(OUTPUT)dump_psb $(OUTPUT)intel_gsic $(OUTPUT)powernow-k8-decode


clean:
clean:
	rm -rf centrino-decode dump_psb intel_gsic powernow-k8-decode
	rm -rf $(OUTPUT){centrino-decode,dump_psb,intel_gsic,powernow-k8-decode}

install:
	$(INSTALL) -d $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)centrino-decode $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)powernow-k8-decode $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)dump_psb $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)intel_gsic $(DESTDIR)${bindir}


.PHONY: all default clean
.PHONY: all default clean install
+21 −5
Original line number Original line Diff line number Diff line
OUTPUT=./
ifeq ("$(origin O)", "command line")
	OUTPUT := $(O)/
endif

DESTDIR =
bindir  = /usr/bin

INSTALL = /usr/bin/install


default: all
default: all


centrino-decode: ../i386/centrino-decode.c
$(OUTPUT)centrino-decode: ../i386/centrino-decode.c
	$(CC) $(CFLAGS) -o $@ $<
	$(CC) $(CFLAGS) -o $@ $<


powernow-k8-decode: ../i386/powernow-k8-decode.c
$(OUTPUT)powernow-k8-decode: ../i386/powernow-k8-decode.c
	$(CC) $(CFLAGS) -o $@ $<
	$(CC) $(CFLAGS) -o $@ $<


all: centrino-decode powernow-k8-decode
all: $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode


clean:
clean:
	rm -rf centrino-decode powernow-k8-decode
	rm -rf $(OUTPUT)centrino-decode $(OUTPUT)powernow-k8-decode

install:
	$(INSTALL) -d $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)centrino-decode $(DESTDIR)${bindir}
	$(INSTALL) $(OUTPUT)powernow-k8-decode $(DESTDIR)${bindir}


.PHONY: all default clean
.PHONY: all default clean install
+1 −3
Original line number Original line Diff line number Diff line
.TH "cpupower-frequency-info" "1" "0.1" "Mattia Dongili" ""
.TH "CPUPOWER\-FREQUENCY\-INFO" "1" "0.1" "" "cpupower Manual"
.SH "NAME"
.SH "NAME"
.LP 
.LP 
cpupower frequency\-info \- Utility to retrieve cpufreq kernel information
cpupower frequency\-info \- Utility to retrieve cpufreq kernel information
@@ -50,8 +50,6 @@ Prints out information like provided by the /proc/cpufreq interface in 2.4. and
\fB\-m\fR \fB\-\-human\fR
\fB\-m\fR \fB\-\-human\fR
human\-readable output for the \-f, \-w, \-s and \-y parameters.
human\-readable output for the \-f, \-w, \-s and \-y parameters.
.TP  
.TP  
\fB\-h\fR \fB\-\-help\fR
Prints out the help screen.
.SH "REMARKS"
.SH "REMARKS"
.LP 
.LP 
By default only values of core zero are displayed. How to display settings of
By default only values of core zero are displayed. How to display settings of
Loading