Commit 148be2c1 authored by Ingo Molnar's avatar Ingo Molnar

perf_counter tools: move helper library to util/*

Clean up the top level directory a bit by moving all the helper libraries
to util/*.[ch].
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f1f9b3b1
...@@ -147,7 +147,7 @@ all:: ...@@ -147,7 +147,7 @@ all::
# broken, or spawning external process is slower than built-in grep perf has). # broken, or spawning external process is slower than built-in grep perf has).
PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) ./PERF-VERSION-GEN @$(SHELL_PATH) util/PERF-VERSION-GEN
-include PERF-VERSION-FILE -include PERF-VERSION-FILE
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
...@@ -287,26 +287,28 @@ export PERL_PATH ...@@ -287,26 +287,28 @@ export PERL_PATH
LIB_FILE=libperf.a LIB_FILE=libperf.a
LIB_H += ../../include/linux/perf_counter.h LIB_H += ../../include/linux/perf_counter.h
LIB_H += levenshtein.h LIB_H += util/levenshtein.h
LIB_H += parse-options.h LIB_H += util/parse-options.h
LIB_H += quote.h LIB_H += util/quote.h
LIB_H += strbuf.h LIB_H += util/util.h
LIB_H += run-command.h LIB_H += util/help.h
LIB_H += util/strbuf.h
LIB_OBJS += abspath.o LIB_H += util/run-command.h
LIB_OBJS += alias.o
LIB_OBJS += config.o LIB_OBJS += util/abspath.o
LIB_OBJS += ctype.o LIB_OBJS += util/alias.o
LIB_OBJS += exec_cmd.o LIB_OBJS += util/config.o
LIB_OBJS += help.o LIB_OBJS += util/ctype.o
LIB_OBJS += levenshtein.o LIB_OBJS += util/exec_cmd.o
LIB_OBJS += parse-options.o LIB_OBJS += util/help.o
LIB_OBJS += path.o LIB_OBJS += util/levenshtein.o
LIB_OBJS += run-command.o LIB_OBJS += util/parse-options.o
LIB_OBJS += quote.o LIB_OBJS += util/path.o
LIB_OBJS += strbuf.o LIB_OBJS += util/run-command.o
LIB_OBJS += usage.o LIB_OBJS += util/quote.o
LIB_OBJS += wrapper.o LIB_OBJS += util/strbuf.o
LIB_OBJS += util/usage.o
LIB_OBJS += util/wrapper.o
BUILTIN_OBJS += builtin-help.o BUILTIN_OBJS += builtin-help.o
BUILTIN_OBJS += builtin-record.o BUILTIN_OBJS += builtin-record.o
...@@ -620,10 +622,10 @@ $(BUILT_INS): perf$X ...@@ -620,10 +622,10 @@ $(BUILT_INS): perf$X
ln -s perf$X $@ 2>/dev/null || \ ln -s perf$X $@ 2>/dev/null || \
cp perf$X $@ cp perf$X $@
common-cmds.h: ./generate-cmdlist.sh command-list.txt common-cmds.h: util/generate-cmdlist.sh command-list.txt
common-cmds.h: $(wildcard Documentation/perf-*.txt) common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@ $(QUIET_GEN)util/generate-cmdlist.sh > $@+ && mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)$(RM) $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
...@@ -656,7 +658,7 @@ perf.o perf.spec \ ...@@ -656,7 +658,7 @@ perf.o perf.spec \
%.o: %.S %.o: %.S
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $< $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
exec_cmd.o: exec_cmd.c PERF-CFLAGS util/exec_cmd.o: util/exec_cmd.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \ $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) \
'-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \ '-DBINDIR="$(bindir_relative_SQ)"' \
...@@ -666,7 +668,7 @@ exec_cmd.o: exec_cmd.c PERF-CFLAGS ...@@ -666,7 +668,7 @@ exec_cmd.o: exec_cmd.c PERF-CFLAGS
builtin-init-db.o: builtin-init-db.c PERF-CFLAGS builtin-init-db.o: builtin-init-db.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $< $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
config.o: config.c PERF-CFLAGS util/config.o: util/config.c PERF-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
perf-%$X: %.o $(PERFLIBS) perf-%$X: %.o $(PERFLIBS)
...@@ -729,7 +731,7 @@ export NO_SVN_TESTS ...@@ -729,7 +731,7 @@ export NO_SVN_TESTS
check: common-cmds.h check: common-cmds.h
if sparse; \ if sparse; \
then \ then \
for i in *.c; \ for i in *.c */*.c; \
do \ do \
sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
done; \ done; \
...@@ -795,7 +797,7 @@ distclean: clean ...@@ -795,7 +797,7 @@ distclean: clean
$(RM) configure $(RM) configure
clean: clean:
$(RM) *.o $(LIB_FILE) $(RM) *.o */*.o $(LIB_FILE)
$(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf$X
$(RM) $(TEST_PROGRAMS) $(RM) $(TEST_PROGRAMS)
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope* $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
...@@ -836,7 +838,7 @@ coverage-build: coverage-clean ...@@ -836,7 +838,7 @@ coverage-build: coverage-clean
-j1 test -j1 test
coverage-report: coverage-report:
gcov -b *.c gcov -b *.c */*.c
grep '^function.*called 0 ' *.c.gcov \ grep '^function.*called 0 ' *.c.gcov */*.c.gcov \
| sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \ | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \
| tee coverage-untested-functions | tee coverage-untested-functions
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* *
* Builtin help command * Builtin help command
*/ */
#include "cache.h" #include "util/cache.h"
#include "builtin.h" #include "builtin.h"
#include "exec_cmd.h" #include "util/exec_cmd.h"
#include "common-cmds.h" #include "common-cmds.h"
#include "parse-options.h" #include "util/parse-options.h"
#include "run-command.h" #include "util/run-command.h"
#include "help.h" #include "util/help.h"
static struct man_viewer_list { static struct man_viewer_list {
struct man_viewer_list *next; struct man_viewer_list *next;
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
* Released under the GPL v2. (and only v2, not any later version) * Released under the GPL v2. (and only v2, not any later version)
*/ */
#include "util.h" #include "util/util.h"
#include <getopt.h> #include <getopt.h>
#include <assert.h> #include <assert.h>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
* Released under the GPL v2. (and only v2, not any later version) * Released under the GPL v2. (and only v2, not any later version)
*/ */
#include "util.h" #include "util/util.h"
#include <getopt.h> #include <getopt.h>
#include <assert.h> #include <assert.h>
......
#ifndef BUILTIN_H #ifndef BUILTIN_H
#define BUILTIN_H #define BUILTIN_H
#include "util.h" #include "util/util.h"
#include "strbuf.h" #include "util/strbuf.h"
extern const char perf_version_string[]; extern const char perf_version_string[];
extern const char perf_usage_string[]; extern const char perf_usage_string[];
......
#include "builtin.h" #include "builtin.h"
#include "exec_cmd.h" #include "util/exec_cmd.h"
#include "cache.h" #include "util/cache.h"
#include "quote.h" #include "util/quote.h"
#include "run-command.h" #include "util/run-command.h"
const char perf_usage_string[] = const char perf_usage_string[] =
"perf [--version] [--help] COMMAND [ARGS]"; "perf [--version] [--help] COMMAND [ARGS]";
......
#include "cache.h" #include "cache.h"
#include "builtin.h" #include "../builtin.h"
#include "exec_cmd.h" #include "exec_cmd.h"
#include "levenshtein.h" #include "levenshtein.h"
#include "help.h" #include "help.h"
......
...@@ -469,9 +469,6 @@ int parse_options_usage(const char * const *usagestr, ...@@ -469,9 +469,6 @@ int parse_options_usage(const char * const *usagestr,
} }
/*----- some often used options -----*/
#include "cache.h"
int parse_opt_verbosity_cb(const struct option *opt, const char *arg, int parse_opt_verbosity_cb(const struct option *opt, const char *arg,
int unset) int unset)
{ {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* run the command on the other side: * run the command on the other side:
* *
* sprintf(cmd, "git-diff-tree %s %s", sq_quote(arg0), sq_quote(arg1)); * sprintf(cmd, "git-diff-tree %s %s", sq_quote(arg0), sq_quote(arg1));
* sprintf(rcmd, "ssh %s %s", sq_quote(host), sq_quote(cmd)); * sprintf(rcmd, "ssh %s %s", sq_util/quote.host), sq_quote(cmd));
* *
* Note that the above examples leak memory! Remember to free result from * Note that the above examples leak memory! Remember to free result from
* sq_quote() in a real application. * sq_quote() in a real application.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment