diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-20 09:22:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-20 11:36:48 -0400 |
commit | 6f06ccbc86f8a02aa32271263249657ce484eb25 (patch) | |
tree | c04eb04fcd1b7da2ec1a0072089cd95317a2cf54 | |
parent | 0780060124011b94af55830939c86cc0916be0f5 (diff) |
perf_counter tools: clean up after introduction of the Git command framework
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | Documentation/perf_counter/Makefile | 207 | ||||
-rw-r--r-- | Documentation/perf_counter/builtin-help.c | 2 | ||||
-rw-r--r-- | Documentation/perf_counter/builtin-top.c | 17 | ||||
-rw-r--r-- | Documentation/perf_counter/cache.h | 20 | ||||
-rw-r--r-- | Documentation/perf_counter/config.c | 95 | ||||
-rw-r--r-- | Documentation/perf_counter/path.c | 39 | ||||
-rw-r--r-- | Documentation/perf_counter/perf.c | 3 | ||||
-rw-r--r-- | Documentation/perf_counter/util.h | 14 |
8 files changed, 45 insertions, 352 deletions
diff --git a/Documentation/perf_counter/Makefile b/Documentation/perf_counter/Makefile index 11809b943fc3..1b6026555547 100644 --- a/Documentation/perf_counter/Makefile +++ b/Documentation/perf_counter/Makefile | |||
@@ -138,16 +138,6 @@ all:: | |||
138 | # | 138 | # |
139 | # Define NO_PERL if you do not want Perl scripts or libraries at all. | 139 | # Define NO_PERL if you do not want Perl scripts or libraries at all. |
140 | # | 140 | # |
141 | # Define NO_TCLTK if you do not want Tcl/Tk GUI. | ||
142 | # | ||
143 | # The TCL_PATH variable governs the location of the Tcl interpreter | ||
144 | # used to optimize perf-gui for your system. Only used if NO_TCLTK | ||
145 | # is not set. Defaults to the bare 'tclsh'. | ||
146 | # | ||
147 | # The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter. | ||
148 | # If not set it defaults to the bare 'wish'. If it is set to the empty | ||
149 | # string then NO_TCLTK will be forced (this is used by configure script). | ||
150 | # | ||
151 | # Define INTERNAL_QSORT to use Git's implementation of qsort(), which | 141 | # Define INTERNAL_QSORT to use Git's implementation of qsort(), which |
152 | # is a simplified version of the merge sort used in glibc. This is | 142 | # is a simplified version of the merge sort used in glibc. This is |
153 | # recommended if Git triggers O(n^2) behavior in your platform's qsort(). | 143 | # recommended if Git triggers O(n^2) behavior in your platform's qsort(). |
@@ -215,12 +205,8 @@ TAR = tar | |||
215 | FIND = find | 205 | FIND = find |
216 | INSTALL = install | 206 | INSTALL = install |
217 | RPMBUILD = rpmbuild | 207 | RPMBUILD = rpmbuild |
218 | TCL_PATH = tclsh | ||
219 | TCLTK_PATH = wish | ||
220 | PTHREAD_LIBS = -lpthread | 208 | PTHREAD_LIBS = -lpthread |
221 | 209 | ||
222 | export TCL_PATH TCLTK_PATH | ||
223 | |||
224 | # sparse is architecture-neutral, which means that we need to tell it | 210 | # sparse is architecture-neutral, which means that we need to tell it |
225 | # explicitly what architecture to check for. Fix this up for yours.. | 211 | # explicitly what architecture to check for. Fix this up for yours.. |
226 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | 212 | SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ |
@@ -529,10 +515,6 @@ ifdef NO_EXTERNAL_GREP | |||
529 | BASIC_CFLAGS += -DNO_EXTERNAL_GREP | 515 | BASIC_CFLAGS += -DNO_EXTERNAL_GREP |
530 | endif | 516 | endif |
531 | 517 | ||
532 | ifeq ($(TCLTK_PATH),) | ||
533 | NO_TCLTK=NoThanks | ||
534 | endif | ||
535 | |||
536 | ifeq ($(PERL_PATH),) | 518 | ifeq ($(PERL_PATH),) |
537 | NO_PERL=NoThanks | 519 | NO_PERL=NoThanks |
538 | endif | 520 | endif |
@@ -583,7 +565,6 @@ prefix_SQ = $(subst ','\'',$(prefix)) | |||
583 | 565 | ||
584 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) | 566 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) |
585 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) | 567 | PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) |
586 | TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) | ||
587 | 568 | ||
588 | LIBS = $(PERFLIBS) $(EXTLIBS) | 569 | LIBS = $(PERFLIBS) $(EXTLIBS) |
589 | 570 | ||
@@ -607,14 +588,6 @@ ifneq (,$X) | |||
607 | endif | 588 | endif |
608 | 589 | ||
609 | all:: | 590 | all:: |
610 | ifndef NO_TCLTK | ||
611 | $(QUIET_SUBDIR0)perf-gui $(QUIET_SUBDIR1) perfexecdir='$(perfexec_instdir_SQ)' all | ||
612 | $(QUIET_SUBDIR0)perfk-perf $(QUIET_SUBDIR1) all | ||
613 | endif | ||
614 | ifndef NO_PERL | ||
615 | $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all | ||
616 | endif | ||
617 | $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) | ||
618 | 591 | ||
619 | please_set_SHELL_PATH_to_a_more_modern_shell: | 592 | please_set_SHELL_PATH_to_a_more_modern_shell: |
620 | @$$(:) | 593 | @$$(:) |
@@ -704,21 +677,6 @@ builtin-revert.o wt-status.o: wt-status.h | |||
704 | $(LIB_FILE): $(LIB_OBJS) | 677 | $(LIB_FILE): $(LIB_OBJS) |
705 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) | 678 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) |
706 | 679 | ||
707 | doc: | ||
708 | $(MAKE) -C Documentation all | ||
709 | |||
710 | man: | ||
711 | $(MAKE) -C Documentation man | ||
712 | |||
713 | html: | ||
714 | $(MAKE) -C Documentation html | ||
715 | |||
716 | info: | ||
717 | $(MAKE) -C Documentation info | ||
718 | |||
719 | pdf: | ||
720 | $(MAKE) -C Documentation pdf | ||
721 | |||
722 | TAGS: | 680 | TAGS: |
723 | $(RM) TAGS | 681 | $(RM) TAGS |
724 | $(FIND) . -name '*.[hcS]' -print | xargs etags -a | 682 | $(FIND) . -name '*.[hcS]' -print | xargs etags -a |
@@ -751,33 +709,12 @@ PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS | |||
751 | @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ | 709 | @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ |
752 | @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@ | 710 | @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@ |
753 | 711 | ||
754 | ### Detect Tck/Tk interpreter path changes | ||
755 | ifndef NO_TCLTK | ||
756 | TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)') | ||
757 | |||
758 | PERF-GUI-VARS: .FORCE-PERF-GUI-VARS | ||
759 | @VARS='$(TRACK_VARS)'; \ | ||
760 | if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \ | ||
761 | echo 1>&2 " * new Tcl/Tk interpreter location"; \ | ||
762 | echo "$$VARS" >$@; \ | ||
763 | fi | ||
764 | |||
765 | .PHONY: .FORCE-PERF-GUI-VARS | ||
766 | endif | ||
767 | |||
768 | ### Testing rules | 712 | ### Testing rules |
769 | 713 | ||
770 | TEST_PROGRAMS += test-chmtime$X | 714 | # |
771 | TEST_PROGRAMS += test-ctype$X | 715 | # None right now: |
772 | TEST_PROGRAMS += test-date$X | 716 | # |
773 | TEST_PROGRAMS += test-delta$X | 717 | # TEST_PROGRAMS += test-something$X |
774 | TEST_PROGRAMS += test-dump-cache-tree$X | ||
775 | TEST_PROGRAMS += test-genrandom$X | ||
776 | TEST_PROGRAMS += test-match-trees$X | ||
777 | TEST_PROGRAMS += test-parse-options$X | ||
778 | TEST_PROGRAMS += test-path-utils$X | ||
779 | TEST_PROGRAMS += test-sha1$X | ||
780 | TEST_PROGRAMS += test-sigchain$X | ||
781 | 718 | ||
782 | all:: $(TEST_PROGRAMS) | 719 | all:: $(TEST_PROGRAMS) |
783 | 720 | ||
@@ -787,25 +724,6 @@ all:: $(TEST_PROGRAMS) | |||
787 | 724 | ||
788 | export NO_SVN_TESTS | 725 | export NO_SVN_TESTS |
789 | 726 | ||
790 | test: all | ||
791 | $(MAKE) -C t/ all | ||
792 | |||
793 | test-ctype$X: ctype.o | ||
794 | |||
795 | test-date$X: date.o ctype.o | ||
796 | |||
797 | test-delta$X: diff-delta.o patch-delta.o | ||
798 | |||
799 | test-parse-options$X: parse-options.o | ||
800 | |||
801 | .PRECIOUS: $(patsubst test-%$X,test-%.o,$(TEST_PROGRAMS)) | ||
802 | |||
803 | test-%$X: test-%.o $(PERFLIBS) | ||
804 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | ||
805 | |||
806 | check-sha1:: test-sha1$X | ||
807 | ./test-sha1.sh | ||
808 | |||
809 | check: common-cmds.h | 727 | check: common-cmds.h |
810 | if sparse; \ | 728 | if sparse; \ |
811 | then \ | 729 | then \ |
@@ -845,10 +763,6 @@ install: all | |||
845 | $(INSTALL) perf$X perf-upload-pack$X perf-receive-pack$X perf-upload-archive$X perf-shell$X perf-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)' | 763 | $(INSTALL) perf$X perf-upload-pack$X perf-receive-pack$X perf-upload-archive$X perf-shell$X perf-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)' |
846 | $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install | 764 | $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install |
847 | $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install | 765 | $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install |
848 | ifndef NO_TCLTK | ||
849 | $(MAKE) -C perfk-perf install | ||
850 | $(MAKE) -C perf-gui perfexecdir='$(perfexec_instdir_SQ)' install | ||
851 | endif | ||
852 | ifneq (,$X) | 766 | ifneq (,$X) |
853 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) | 767 | $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) |
854 | endif | 768 | endif |
@@ -865,32 +779,6 @@ endif | |||
865 | done } && \ | 779 | done } && \ |
866 | ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/perf-add$X" | 780 | ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/perf-add$X" |
867 | 781 | ||
868 | install-doc: | ||
869 | $(MAKE) -C Documentation install | ||
870 | |||
871 | install-man: | ||
872 | $(MAKE) -C Documentation install-man | ||
873 | |||
874 | install-html: | ||
875 | $(MAKE) -C Documentation install-html | ||
876 | |||
877 | install-info: | ||
878 | $(MAKE) -C Documentation install-info | ||
879 | |||
880 | install-pdf: | ||
881 | $(MAKE) -C Documentation install-pdf | ||
882 | |||
883 | quick-install-doc: | ||
884 | $(MAKE) -C Documentation quick-install | ||
885 | |||
886 | quick-install-man: | ||
887 | $(MAKE) -C Documentation quick-install-man | ||
888 | |||
889 | quick-install-html: | ||
890 | $(MAKE) -C Documentation quick-install-html | ||
891 | |||
892 | |||
893 | |||
894 | ### Maintainer's dist rules | 782 | ### Maintainer's dist rules |
895 | 783 | ||
896 | perf.spec: perf.spec.in | 784 | perf.spec: perf.spec.in |
@@ -904,38 +792,16 @@ dist: perf.spec perf-archive$(X) configure | |||
904 | @mkdir -p $(PERF_TARNAME) | 792 | @mkdir -p $(PERF_TARNAME) |
905 | @cp perf.spec configure $(PERF_TARNAME) | 793 | @cp perf.spec configure $(PERF_TARNAME) |
906 | @echo $(PERF_VERSION) > $(PERF_TARNAME)/version | 794 | @echo $(PERF_VERSION) > $(PERF_TARNAME)/version |
907 | @$(MAKE) -C perf-gui TARDIR=../$(PERF_TARNAME)/perf-gui dist-version | ||
908 | $(TAR) rf $(PERF_TARNAME).tar \ | 795 | $(TAR) rf $(PERF_TARNAME).tar \ |
909 | $(PERF_TARNAME)/perf.spec \ | 796 | $(PERF_TARNAME)/perf.spec \ |
910 | $(PERF_TARNAME)/configure \ | 797 | $(PERF_TARNAME)/configure \ |
911 | $(PERF_TARNAME)/version \ | 798 | $(PERF_TARNAME)/version |
912 | $(PERF_TARNAME)/perf-gui/version | ||
913 | @$(RM) -r $(PERF_TARNAME) | 799 | @$(RM) -r $(PERF_TARNAME) |
914 | gzip -f -9 $(PERF_TARNAME).tar | 800 | gzip -f -9 $(PERF_TARNAME).tar |
915 | 801 | ||
916 | rpm: dist | 802 | rpm: dist |
917 | $(RPMBUILD) -ta $(PERF_TARNAME).tar.gz | 803 | $(RPMBUILD) -ta $(PERF_TARNAME).tar.gz |
918 | 804 | ||
919 | htmldocs = perf-htmldocs-$(PERF_VERSION) | ||
920 | manpages = perf-manpages-$(PERF_VERSION) | ||
921 | dist-doc: | ||
922 | $(RM) -r .doc-tmp-dir | ||
923 | mkdir .doc-tmp-dir | ||
924 | $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc | ||
925 | cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar . | ||
926 | gzip -n -9 -f $(htmldocs).tar | ||
927 | : | ||
928 | $(RM) -r .doc-tmp-dir | ||
929 | mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7 | ||
930 | $(MAKE) -C Documentation DESTDIR=./ \ | ||
931 | man1dir=../.doc-tmp-dir/man1 \ | ||
932 | man5dir=../.doc-tmp-dir/man5 \ | ||
933 | man7dir=../.doc-tmp-dir/man7 \ | ||
934 | install | ||
935 | cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar . | ||
936 | gzip -n -9 -f $(manpages).tar | ||
937 | $(RM) -r .doc-tmp-dir | ||
938 | |||
939 | ### Cleaning rules | 805 | ### Cleaning rules |
940 | 806 | ||
941 | distclean: clean | 807 | distclean: clean |
@@ -951,74 +817,13 @@ clean: | |||
951 | $(RM) -r $(PERF_TARNAME) .doc-tmp-dir | 817 | $(RM) -r $(PERF_TARNAME) .doc-tmp-dir |
952 | $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz | 818 | $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz |
953 | $(RM) $(htmldocs).tar.gz $(manpages).tar.gz | 819 | $(RM) $(htmldocs).tar.gz $(manpages).tar.gz |
954 | $(MAKE) -C Documentation/ clean | 820 | $(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS |
955 | $(MAKE) -C templates/ clean | ||
956 | $(MAKE) -C t/ clean | ||
957 | ifndef NO_TCLTK | ||
958 | $(MAKE) -C perfk-perf clean | ||
959 | $(MAKE) -C perf-gui clean | ||
960 | endif | ||
961 | $(RM) PERF-VERSION-FILE PERF-CFLAGS PERF-GUI-VARS PERF-BUILD-OPTIONS | ||
962 | 821 | ||
963 | .PHONY: all install clean strip | 822 | .PHONY: all install clean strip |
964 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell | 823 | .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell |
965 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS | 824 | .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS |
966 | .PHONY: .FORCE-PERF-BUILD-OPTIONS | 825 | .PHONY: .FORCE-PERF-BUILD-OPTIONS |
967 | 826 | ||
968 | ### Check documentation | ||
969 | # | ||
970 | check-docs:: | ||
971 | @(for v in $(ALL_PROGRAMS) $(BUILT_INS) perf perfk; \ | ||
972 | do \ | ||
973 | case "$$v" in \ | ||
974 | perf-merge-octopus | perf-merge-ours | perf-merge-recursive | \ | ||
975 | perf-merge-resolve | perf-merge-subtree | \ | ||
976 | perf-fsck-objects | perf-init-db | \ | ||
977 | perf-?*--?* ) continue ;; \ | ||
978 | esac ; \ | ||
979 | test -f "Documentation/$$v.txt" || \ | ||
980 | echo "no doc: $$v"; \ | ||
981 | sed -e '/^#/d' command-list.txt | \ | ||
982 | grep -q "^$$v[ ]" || \ | ||
983 | case "$$v" in \ | ||
984 | perf) ;; \ | ||
985 | *) echo "no link: $$v";; \ | ||
986 | esac ; \ | ||
987 | done; \ | ||
988 | ( \ | ||
989 | sed -e '/^#/d' \ | ||
990 | -e 's/[ ].*//' \ | ||
991 | -e 's/^/listed /' command-list.txt; \ | ||
992 | ls -1 Documentation/perf*txt | \ | ||
993 | sed -e 's|Documentation/|documented |' \ | ||
994 | -e 's/\.txt//'; \ | ||
995 | ) | while read how cmd; \ | ||
996 | do \ | ||
997 | case "$$how,$$cmd" in \ | ||
998 | *,perf-citool | \ | ||
999 | *,perf-gui | \ | ||
1000 | *,perf-help | \ | ||
1001 | documented,perfattributes | \ | ||
1002 | documented,perfignore | \ | ||
1003 | documented,perfmodules | \ | ||
1004 | documented,perfcli | \ | ||
1005 | documented,perf-tools | \ | ||
1006 | documented,perfcore-tutorial | \ | ||
1007 | documented,perfcvs-migration | \ | ||
1008 | documented,perfdiffcore | \ | ||
1009 | documented,perfglossary | \ | ||
1010 | documented,perfhooks | \ | ||
1011 | documented,perfrepository-layout | \ | ||
1012 | documented,perftutorial | \ | ||
1013 | documented,perftutorial-2 | \ | ||
1014 | sentinel,not,matching,is,ok ) continue ;; \ | ||
1015 | esac; \ | ||
1016 | case " $(ALL_PROGRAMS) $(BUILT_INS) perf perfk " in \ | ||
1017 | *" $$cmd "*) ;; \ | ||
1018 | *) echo "removed but $$how: $$cmd" ;; \ | ||
1019 | esac; \ | ||
1020 | done ) | sort | ||
1021 | |||
1022 | ### Make sure built-ins do not have dups and listed in perf.c | 827 | ### Make sure built-ins do not have dups and listed in perf.c |
1023 | # | 828 | # |
1024 | check-builtins:: | 829 | check-builtins:: |
diff --git a/Documentation/perf_counter/builtin-help.c b/Documentation/perf_counter/builtin-help.c index 125fcc2f4901..a136d619db37 100644 --- a/Documentation/perf_counter/builtin-help.c +++ b/Documentation/perf_counter/builtin-help.c | |||
@@ -417,11 +417,9 @@ static void show_html_page(const char *perf_cmd) | |||
417 | 417 | ||
418 | int cmd_help(int argc, const char **argv, const char *prefix) | 418 | int cmd_help(int argc, const char **argv, const char *prefix) |
419 | { | 419 | { |
420 | int nonperf; | ||
421 | const char *alias; | 420 | const char *alias; |
422 | load_command_list("perf-", &main_cmds, &other_cmds); | 421 | load_command_list("perf-", &main_cmds, &other_cmds); |
423 | 422 | ||
424 | /* setup_perf_directory_gently(&nonperf); */ | ||
425 | perf_config(perf_help_config, NULL); | 423 | perf_config(perf_help_config, NULL); |
426 | 424 | ||
427 | argc = parse_options(argc, argv, builtin_help_options, | 425 | argc = parse_options(argc, argv, builtin_help_options, |
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c index 9d2c769e5f83..601bddbc30d5 100644 --- a/Documentation/perf_counter/builtin-top.c +++ b/Documentation/perf_counter/builtin-top.c | |||
@@ -63,15 +63,6 @@ | |||
63 | 63 | ||
64 | #include "util.h" | 64 | #include "util.h" |
65 | 65 | ||
66 | #define _GNU_SOURCE | ||
67 | #include <sys/types.h> | ||
68 | #include <sys/stat.h> | ||
69 | #include <sys/time.h> | ||
70 | #include <unistd.h> | ||
71 | #include <stdint.h> | ||
72 | #include <stdlib.h> | ||
73 | #include <string.h> | ||
74 | #include <limits.h> | ||
75 | #include <getopt.h> | 66 | #include <getopt.h> |
76 | #include <assert.h> | 67 | #include <assert.h> |
77 | #include <fcntl.h> | 68 | #include <fcntl.h> |
@@ -103,8 +94,6 @@ | |||
103 | #define PR_TASK_PERF_COUNTERS_DISABLE 31 | 94 | #define PR_TASK_PERF_COUNTERS_DISABLE 31 |
104 | #define PR_TASK_PERF_COUNTERS_ENABLE 32 | 95 | #define PR_TASK_PERF_COUNTERS_ENABLE 32 |
105 | 96 | ||
106 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
107 | |||
108 | #define rdclock() \ | 97 | #define rdclock() \ |
109 | ({ \ | 98 | ({ \ |
110 | struct timespec ts; \ | 99 | struct timespec ts; \ |
@@ -1077,7 +1066,7 @@ static void process_event(uint64_t ip, int counter) | |||
1077 | record_ip(ip, counter); | 1066 | record_ip(ip, counter); |
1078 | } | 1067 | } |
1079 | 1068 | ||
1080 | static void process_options(int argc, char *argv[]) | 1069 | static void process_options(int argc, char **argv) |
1081 | { | 1070 | { |
1082 | int error = 0, counter; | 1071 | int error = 0, counter; |
1083 | 1072 | ||
@@ -1255,7 +1244,7 @@ static void mmap_read(struct mmap_data *md) | |||
1255 | 1244 | ||
1256 | event_t event_copy; | 1245 | event_t event_copy; |
1257 | 1246 | ||
1258 | unsigned int size = event->header.size; | 1247 | size_t size = event->header.size; |
1259 | 1248 | ||
1260 | /* | 1249 | /* |
1261 | * Event straddles the mmap boundary -- header should always | 1250 | * Event straddles the mmap boundary -- header should always |
@@ -1301,7 +1290,7 @@ static void mmap_read(struct mmap_data *md) | |||
1301 | md->prev = old; | 1290 | md->prev = old; |
1302 | } | 1291 | } |
1303 | 1292 | ||
1304 | int cmd_top(int argc, const char **argv, const char *prefix) | 1293 | int cmd_top(int argc, char **argv, const char *prefix) |
1305 | { | 1294 | { |
1306 | struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS]; | 1295 | struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS]; |
1307 | struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS]; | 1296 | struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS]; |
diff --git a/Documentation/perf_counter/cache.h b/Documentation/perf_counter/cache.h index dc085640a57d..71080512fa86 100644 --- a/Documentation/perf_counter/cache.h +++ b/Documentation/perf_counter/cache.h | |||
@@ -94,4 +94,24 @@ static inline int is_absolute_path(const char *path) | |||
94 | { | 94 | { |
95 | return path[0] == '/'; | 95 | return path[0] == '/'; |
96 | } | 96 | } |
97 | |||
98 | const char *make_absolute_path(const char *path); | ||
99 | const char *make_nonrelative_path(const char *path); | ||
100 | const char *make_relative_path(const char *abs, const char *base); | ||
101 | int normalize_path_copy(char *dst, const char *src); | ||
102 | int longest_ancestor_length(const char *path, const char *prefix_list); | ||
103 | char *strip_path_suffix(const char *path, const char *suffix); | ||
104 | |||
105 | extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); | ||
106 | extern char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); | ||
107 | |||
108 | extern char *mksnpath(char *buf, size_t n, const char *fmt, ...) | ||
109 | __attribute__((format (printf, 3, 4))); | ||
110 | extern char *perf_snpath(char *buf, size_t n, const char *fmt, ...) | ||
111 | __attribute__((format (printf, 3, 4))); | ||
112 | extern char *perf_pathdup(const char *fmt, ...) | ||
113 | __attribute__((format (printf, 1, 2))); | ||
114 | |||
115 | extern size_t strlcpy(char *dest, const char *src, size_t size); | ||
116 | |||
97 | #endif /* CACHE_H */ | 117 | #endif /* CACHE_H */ |
diff --git a/Documentation/perf_counter/config.c b/Documentation/perf_counter/config.c index 672d53959334..3dd13faa6a27 100644 --- a/Documentation/perf_counter/config.c +++ b/Documentation/perf_counter/config.c | |||
@@ -15,7 +15,6 @@ static FILE *config_file; | |||
15 | static const char *config_file_name; | 15 | static const char *config_file_name; |
16 | static int config_linenr; | 16 | static int config_linenr; |
17 | static int config_file_eof; | 17 | static int config_file_eof; |
18 | static int zlib_compression_seen; | ||
19 | 18 | ||
20 | const char *config_exclusive_filename = NULL; | 19 | const char *config_exclusive_filename = NULL; |
21 | 20 | ||
@@ -533,14 +532,6 @@ static int store_aux(const char* key, const char* value, void *cb) | |||
533 | return 0; | 532 | return 0; |
534 | } | 533 | } |
535 | 534 | ||
536 | static int write_error(const char *filename) | ||
537 | { | ||
538 | error("failed to write new configuration file %s", filename); | ||
539 | |||
540 | /* Same error code as "failed to rename". */ | ||
541 | return 4; | ||
542 | } | ||
543 | |||
544 | static int store_write_section(int fd, const char* key) | 535 | static int store_write_section(int fd, const char* key) |
545 | { | 536 | { |
546 | const char *dot; | 537 | const char *dot; |
@@ -673,7 +664,7 @@ int perf_config_set_multivar(const char* key, const char* value, | |||
673 | { | 664 | { |
674 | int i, dot; | 665 | int i, dot; |
675 | int fd = -1, in_fd; | 666 | int fd = -1, in_fd; |
676 | int ret; | 667 | int ret = 0; |
677 | char* config_filename; | 668 | char* config_filename; |
678 | const char* last_dot = strrchr(key, '.'); | 669 | const char* last_dot = strrchr(key, '.'); |
679 | 670 | ||
@@ -872,90 +863,6 @@ write_err_out: | |||
872 | 863 | ||
873 | } | 864 | } |
874 | 865 | ||
875 | static int section_name_match (const char *buf, const char *name) | ||
876 | { | ||
877 | int i = 0, j = 0, dot = 0; | ||
878 | for (; buf[i] && buf[i] != ']'; i++) { | ||
879 | if (!dot && isspace(buf[i])) { | ||
880 | dot = 1; | ||
881 | if (name[j++] != '.') | ||
882 | break; | ||
883 | for (i++; isspace(buf[i]); i++) | ||
884 | ; /* do nothing */ | ||
885 | if (buf[i] != '"') | ||
886 | break; | ||
887 | continue; | ||
888 | } | ||
889 | if (buf[i] == '\\' && dot) | ||
890 | i++; | ||
891 | else if (buf[i] == '"' && dot) { | ||
892 | for (i++; isspace(buf[i]); i++) | ||
893 | ; /* do_nothing */ | ||
894 | break; | ||
895 | } | ||
896 | if (buf[i] != name[j++]) | ||
897 | break; | ||
898 | } | ||
899 | return (buf[i] == ']' && name[j] == 0); | ||
900 | } | ||
901 | |||
902 | /* if new_name == NULL, the section is removed instead */ | ||
903 | int perf_config_rename_section(const char *old_name, const char *new_name) | ||
904 | { | ||
905 | int ret = 0, remove = 0; | ||
906 | char *config_filename; | ||
907 | int out_fd; | ||
908 | char buf[1024]; | ||
909 | |||
910 | if (config_exclusive_filename) | ||
911 | config_filename = strdup(config_exclusive_filename); | ||
912 | else | ||
913 | config_filename = perf_pathdup("config"); | ||
914 | if (out_fd < 0) { | ||
915 | ret = error("could not lock config file %s", config_filename); | ||
916 | goto out; | ||
917 | } | ||
918 | |||
919 | if (!(config_file = fopen(config_filename, "rb"))) { | ||
920 | /* no config file means nothing to rename, no error */ | ||
921 | goto unlock_and_out; | ||
922 | } | ||
923 | |||
924 | while (fgets(buf, sizeof(buf), config_file)) { | ||
925 | int i; | ||
926 | int length; | ||
927 | for (i = 0; buf[i] && isspace(buf[i]); i++) | ||
928 | ; /* do nothing */ | ||
929 | if (buf[i] == '[') { | ||
930 | /* it's a section */ | ||
931 | if (section_name_match (&buf[i+1], old_name)) { | ||
932 | ret++; | ||
933 | if (new_name == NULL) { | ||
934 | remove = 1; | ||
935 | continue; | ||
936 | } | ||
937 | store.baselen = strlen(new_name); | ||
938 | if (!store_write_section(out_fd, new_name)) { | ||
939 | goto out; | ||
940 | } | ||
941 | continue; | ||
942 | } | ||
943 | remove = 0; | ||
944 | } | ||
945 | if (remove) | ||
946 | continue; | ||
947 | length = strlen(buf); | ||
948 | if (write_in_full(out_fd, buf, length) != length) { | ||
949 | goto out; | ||
950 | } | ||
951 | } | ||
952 | fclose(config_file); | ||
953 | unlock_and_out: | ||
954 | out: | ||
955 | free(config_filename); | ||
956 | return ret; | ||
957 | } | ||
958 | |||
959 | /* | 866 | /* |
960 | * Call this to report error for your variable that should not | 867 | * Call this to report error for your variable that should not |
961 | * get a boolean value (i.e. "[my] var" means "true"). | 868 | * get a boolean value (i.e. "[my] var" means "true"). |
diff --git a/Documentation/perf_counter/path.c b/Documentation/perf_counter/path.c index 891b612ec1a9..a501a40dd2cb 100644 --- a/Documentation/perf_counter/path.c +++ b/Documentation/perf_counter/path.c | |||
@@ -161,45 +161,6 @@ int perf_mkstemp(char *path, size_t len, const char *template) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static char *user_path(char *buf, char *path, int sz) | ||
165 | { | ||
166 | struct passwd *pw; | ||
167 | char *slash; | ||
168 | int len, baselen; | ||
169 | |||
170 | if (!path || path[0] != '~') | ||
171 | return NULL; | ||
172 | path++; | ||
173 | slash = strchr(path, '/'); | ||
174 | if (path[0] == '/' || !path[0]) { | ||
175 | pw = getpwuid(getuid()); | ||
176 | } | ||
177 | else { | ||
178 | if (slash) { | ||
179 | *slash = 0; | ||
180 | pw = getpwnam(path); | ||
181 | *slash = '/'; | ||
182 | } | ||
183 | else | ||
184 | pw = getpwnam(path); | ||
185 | } | ||
186 | if (!pw || !pw->pw_dir || sz <= strlen(pw->pw_dir)) | ||
187 | return NULL; | ||
188 | baselen = strlen(pw->pw_dir); | ||
189 | memcpy(buf, pw->pw_dir, baselen); | ||
190 | while ((1 < baselen) && (buf[baselen-1] == '/')) { | ||
191 | buf[baselen-1] = 0; | ||
192 | baselen--; | ||
193 | } | ||
194 | if (slash && slash[1]) { | ||
195 | len = strlen(slash); | ||
196 | if (sz <= baselen + len) | ||
197 | return NULL; | ||
198 | memcpy(buf + baselen, slash, len + 1); | ||
199 | } | ||
200 | return buf; | ||
201 | } | ||
202 | |||
203 | const char *make_relative_path(const char *abs, const char *base) | 164 | const char *make_relative_path(const char *abs, const char *base) |
204 | { | 165 | { |
205 | static char buf[PATH_MAX + 1]; | 166 | static char buf[PATH_MAX + 1]; |
diff --git a/Documentation/perf_counter/perf.c b/Documentation/perf_counter/perf.c index 9256f6a16446..63f8a892c0df 100644 --- a/Documentation/perf_counter/perf.c +++ b/Documentation/perf_counter/perf.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include "builtin.h" | 1 | #include "builtin.h" |
2 | #include "exec_cmd.h" | 2 | #include "exec_cmd.h" |
3 | #include "cache.h" | 3 | #include "cache.h" |
4 | //#include "quote.h" | 4 | #include "quote.h" |
5 | #include "run-command.h" | 5 | #include "run-command.h" |
6 | 6 | ||
7 | const char perf_usage_string[] = | 7 | const char perf_usage_string[] = |
@@ -132,7 +132,6 @@ static int handle_alias(int *argcp, const char ***argv) | |||
132 | const char** new_argv; | 132 | const char** new_argv; |
133 | const char *alias_command; | 133 | const char *alias_command; |
134 | char *alias_string; | 134 | char *alias_string; |
135 | int unused_nonperf; | ||
136 | 135 | ||
137 | alias_command = (*argv)[0]; | 136 | alias_command = (*argv)[0]; |
138 | alias_string = alias_lookup(alias_command); | 137 | alias_string = alias_lookup(alias_command); |
diff --git a/Documentation/perf_counter/util.h b/Documentation/perf_counter/util.h index 13f8bdce7600..36e40c38e093 100644 --- a/Documentation/perf_counter/util.h +++ b/Documentation/perf_counter/util.h | |||
@@ -295,6 +295,20 @@ static inline char *gitstrchrnul(const char *s, int c) | |||
295 | } | 295 | } |
296 | #endif | 296 | #endif |
297 | 297 | ||
298 | /* | ||
299 | * Wrappers: | ||
300 | */ | ||
301 | extern char *xstrdup(const char *str); | ||
302 | extern void *xmalloc(size_t size); | ||
303 | extern void *xmemdupz(const void *data, size_t len); | ||
304 | extern char *xstrndup(const char *str, size_t len); | ||
305 | extern void *xrealloc(void *ptr, size_t size); | ||
306 | extern void *xcalloc(size_t nmemb, size_t size); | ||
307 | extern void *xmmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); | ||
308 | extern ssize_t xread(int fd, void *buf, size_t len); | ||
309 | extern ssize_t xwrite(int fd, const void *buf, size_t len); | ||
310 | extern int xdup(int fd); | ||
311 | extern FILE *xfdopen(int fd, const char *mode); | ||
298 | static inline size_t xsize_t(off_t len) | 312 | static inline size_t xsize_t(off_t len) |
299 | { | 313 | { |
300 | return (size_t)len; | 314 | return (size_t)len; |