Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6f06ccbc
Commit
6f06ccbc
authored
Apr 20, 2009
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf_counter tools: clean up after introduction of the Git command framework
Signed-off-by:
Ingo Molnar
<
mingo@elte.hu
>
parent
07800601
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
352 deletions
+45
-352
Documentation/perf_counter/Makefile
Documentation/perf_counter/Makefile
+6
-201
Documentation/perf_counter/builtin-help.c
Documentation/perf_counter/builtin-help.c
+0
-2
Documentation/perf_counter/builtin-top.c
Documentation/perf_counter/builtin-top.c
+3
-14
Documentation/perf_counter/cache.h
Documentation/perf_counter/cache.h
+20
-0
Documentation/perf_counter/config.c
Documentation/perf_counter/config.c
+1
-94
Documentation/perf_counter/path.c
Documentation/perf_counter/path.c
+0
-39
Documentation/perf_counter/perf.c
Documentation/perf_counter/perf.c
+1
-2
Documentation/perf_counter/util.h
Documentation/perf_counter/util.h
+14
-0
No files found.
Documentation/perf_counter/Makefile
View file @
6f06ccbc
...
@@ -138,16 +138,6 @@ all::
...
@@ -138,16 +138,6 @@ all::
#
#
# Define NO_PERL if you do not want Perl scripts or libraries at all.
# Define NO_PERL if you do not want Perl scripts or libraries at all.
#
#
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
# The TCL_PATH variable governs the location of the Tcl interpreter
# used to optimize perf-gui for your system. Only used if NO_TCLTK
# is not set. Defaults to the bare 'tclsh'.
#
# The TCLTK_PATH variable governs the location of the Tcl/Tk interpreter.
# If not set it defaults to the bare 'wish'. If it is set to the empty
# string then NO_TCLTK will be forced (this is used by configure script).
#
# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
# Define INTERNAL_QSORT to use Git's implementation of qsort(), which
# is a simplified version of the merge sort used in glibc. This is
# is a simplified version of the merge sort used in glibc. This is
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
...
@@ -215,12 +205,8 @@ TAR = tar
...
@@ -215,12 +205,8 @@ TAR = tar
FIND
=
find
FIND
=
find
INSTALL
=
install
INSTALL
=
install
RPMBUILD
=
rpmbuild
RPMBUILD
=
rpmbuild
TCL_PATH
=
tclsh
TCLTK_PATH
=
wish
PTHREAD_LIBS
=
-lpthread
PTHREAD_LIBS
=
-lpthread
export
TCL_PATH
TCLTK_PATH
# sparse is architecture-neutral, which means that we need to tell it
# sparse is architecture-neutral, which means that we need to tell it
# explicitly what architecture to check for. Fix this up for yours..
# explicitly what architecture to check for. Fix this up for yours..
SPARSE_FLAGS
=
-D__BIG_ENDIAN__
-D__powerpc__
SPARSE_FLAGS
=
-D__BIG_ENDIAN__
-D__powerpc__
...
@@ -529,10 +515,6 @@ ifdef NO_EXTERNAL_GREP
...
@@ -529,10 +515,6 @@ ifdef NO_EXTERNAL_GREP
BASIC_CFLAGS
+=
-DNO_EXTERNAL_GREP
BASIC_CFLAGS
+=
-DNO_EXTERNAL_GREP
endif
endif
ifeq
($(TCLTK_PATH),)
NO_TCLTK
=
NoThanks
endif
ifeq
($(PERL_PATH),)
ifeq
($(PERL_PATH),)
NO_PERL
=
NoThanks
NO_PERL
=
NoThanks
endif
endif
...
@@ -583,7 +565,6 @@ prefix_SQ = $(subst ','\'',$(prefix))
...
@@ -583,7 +565,6 @@ prefix_SQ = $(subst ','\'',$(prefix))
SHELL_PATH_SQ
=
$(
subst
'
,
'\'',
$(SHELL_PATH)
)
SHELL_PATH_SQ
=
$(
subst
'
,
'\'',
$(SHELL_PATH)
)
PERL_PATH_SQ
=
$(
subst
'
,
'\'',
$(PERL_PATH)
)
PERL_PATH_SQ
=
$(
subst
'
,
'\'',
$(PERL_PATH)
)
TCLTK_PATH_SQ
=
$(
subst
'
,
'\'',
$(TCLTK_PATH)
)
LIBS
=
$(PERFLIBS)
$(EXTLIBS)
LIBS
=
$(PERFLIBS)
$(EXTLIBS)
...
@@ -607,14 +588,6 @@ ifneq (,$X)
...
@@ -607,14 +588,6 @@ ifneq (,$X)
endif
endif
all
::
all
::
ifndef
NO_TCLTK
$(QUIET_SUBDIR0)
perf-gui
$(QUIET_SUBDIR1)
perfexecdir
=
'
$(perfexec_instdir_SQ)
'
all
$(QUIET_SUBDIR0)
perfk-perf
$(QUIET_SUBDIR1)
all
endif
ifndef
NO_PERL
$(QUIET_SUBDIR0)
perl
$(QUIET_SUBDIR1)
PERL_PATH
=
'
$(PERL_PATH_SQ)
'
prefix
=
'
$(prefix_SQ)
'
all
endif
$(QUIET_SUBDIR0)
templates
$(QUIET_SUBDIR1)
please_set_SHELL_PATH_to_a_more_modern_shell
:
please_set_SHELL_PATH_to_a_more_modern_shell
:
@
$$
(
:
)
@
$$
(
:
)
...
@@ -704,21 +677,6 @@ builtin-revert.o wt-status.o: wt-status.h
...
@@ -704,21 +677,6 @@ builtin-revert.o wt-status.o: wt-status.h
$(LIB_FILE)
:
$(LIB_OBJS)
$(LIB_FILE)
:
$(LIB_OBJS)
$(QUIET_AR)$(RM)
$@
&&
$(AR)
rcs
$@
$(LIB_OBJS)
$(QUIET_AR)$(RM)
$@
&&
$(AR)
rcs
$@
$(LIB_OBJS)
doc
:
$(MAKE)
-C
Documentation all
man
:
$(MAKE)
-C
Documentation man
html
:
$(MAKE)
-C
Documentation html
info
:
$(MAKE)
-C
Documentation info
pdf
:
$(MAKE)
-C
Documentation pdf
TAGS
:
TAGS
:
$(RM)
TAGS
$(RM)
TAGS
$(FIND)
.
-name
'*.[hcS]'
-print
| xargs etags
-a
$(FIND)
.
-name
'*.[hcS]'
-print
| xargs etags
-a
...
@@ -751,33 +709,12 @@ PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS
...
@@ -751,33 +709,12 @@ PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS
@
echo
NO_CURL
=
\'
'
$(
subst
'
,
'\'',
$(
subst
'
,
'\'',
$(NO_CURL)
))
'
\'
>>
$@
@
echo
NO_CURL
=
\'
'
$(
subst
'
,
'\'',
$(
subst
'
,
'\'',
$(NO_CURL)
))
'
\'
>>
$@
@
echo
NO_PERL
=
\'
'
$(
subst
'
,
'\'',
$(
subst
'
,
'\'',
$(NO_PERL)
))
'
\'
>>
$@
@
echo
NO_PERL
=
\'
'
$(
subst
'
,
'\'',
$(
subst
'
,
'\'',
$(NO_PERL)
))
'
\'
>>
$@
### Detect Tck/Tk interpreter path changes
ifndef
NO_TCLTK
TRACK_VARS
=
$(
subst
','
\'
',-DTCLTK_PATH='
$(TCLTK_PATH_SQ)
'
)
PERF-GUI-VARS
:
.FORCE-PERF-GUI-VARS
@
VARS='
$(TRACK_VARS)
'; \
if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
echo 1>&2 " * new Tcl/Tk interpreter location"; \
echo "$$VARS" >$@; \
fi
.PHONY
:
.FORCE-PERF-GUI-VARS
endif
### Testing rules
### Testing rules
TEST_PROGRAMS
+=
test-chmtime
$X
#
TEST_PROGRAMS
+=
test-ctype
$X
# None right now:
TEST_PROGRAMS
+=
test-date
$X
#
TEST_PROGRAMS
+=
test-delta
$X
# TEST_PROGRAMS += test-something$X
TEST_PROGRAMS
+=
test-dump-cache-tree
$X
TEST_PROGRAMS
+=
test-genrandom
$X
TEST_PROGRAMS
+=
test-match-trees
$X
TEST_PROGRAMS
+=
test-parse-options
$X
TEST_PROGRAMS
+=
test-path-utils
$X
TEST_PROGRAMS
+=
test-sha1
$X
TEST_PROGRAMS
+=
test-sigchain
$X
all
::
$(TEST_PROGRAMS)
all
::
$(TEST_PROGRAMS)
...
@@ -787,25 +724,6 @@ all:: $(TEST_PROGRAMS)
...
@@ -787,25 +724,6 @@ all:: $(TEST_PROGRAMS)
export
NO_SVN_TESTS
export
NO_SVN_TESTS
test
:
all
$(MAKE)
-C
t/ all
test-ctype$X
:
ctype.o
test-date$X
:
date.o ctype.o
test-delta$X
:
diff-delta.o patch-delta.o
test-parse-options$X
:
parse-options.o
.PRECIOUS
:
$(patsubst test-%$X
,
test-%.o
,
$(TEST_PROGRAMS))
test-%$X
:
test-%.o $(PERFLIBS)
$(QUIET_LINK)$(CC)
$(ALL_CFLAGS)
-o
$@
$(ALL_LDFLAGS)
$(
filter
%.o,
$^
)
$(LIBS)
check-sha1
::
test-sha1$X
./test-sha1.sh
check
:
common-cmds.h
check
:
common-cmds.h
if
sparse
;
\
if
sparse
;
\
then
\
then
\
...
@@ -845,10 +763,6 @@ install: all
...
@@ -845,10 +763,6 @@ install: all
$(INSTALL)
perf$X perf-upload-pack$X perf-receive-pack$X perf-upload-archive$X perf-shell$X perf-cvsserver '
$(DESTDIR_SQ)$(bindir_SQ)
'
$(INSTALL)
perf$X perf-upload-pack$X perf-receive-pack$X perf-upload-archive$X perf-shell$X perf-cvsserver '
$(DESTDIR_SQ)$(bindir_SQ)
'
$(MAKE)
-C templates DESTDIR='
$(DESTDIR_SQ)
' install
$(MAKE)
-C templates DESTDIR='
$(DESTDIR_SQ)
' install
$(MAKE)
-C perl prefix='
$(prefix_SQ)
' DESTDIR='
$(DESTDIR_SQ)
' install
$(MAKE)
-C perl prefix='
$(prefix_SQ)
' DESTDIR='
$(DESTDIR_SQ)
' install
ifndef
NO_TCLTK
$(MAKE)
-C perfk-perf install
$(MAKE)
-C perf-gui perfexecdir='
$(perfexec_instdir_SQ)
' install
endif
ifneq
(,$X)
ifneq
(,$X)
$(
foreach
p,
$(
patsubst
%$X,%,
$(
filter
%$X,
$(ALL_PROGRAMS)
$(BUILT_INS)
perf$X
))
,
$(RM)
'
$(DESTDIR_SQ)$(perfexec_instdir_SQ)
/
$p
';
)
$(
foreach
p,
$(
patsubst
%$X,%,
$(
filter
%$X,
$(ALL_PROGRAMS)
$(BUILT_INS)
perf$X
))
,
$(RM)
'
$(DESTDIR_SQ)$(perfexec_instdir_SQ)
/
$p
';
)
endif
endif
...
@@ -865,32 +779,6 @@ endif
...
@@ -865,32 +779,6 @@ endif
done } && \
done } && \
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/perf-add$X"
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/perf-add$X"
install-doc
:
$(MAKE)
-C
Documentation
install
install-man
:
$(MAKE)
-C
Documentation install-man
install-html
:
$(MAKE)
-C
Documentation install-html
install-info
:
$(MAKE)
-C
Documentation install-info
install-pdf
:
$(MAKE)
-C
Documentation install-pdf
quick-install-doc
:
$(MAKE)
-C
Documentation quick-install
quick-install-man
:
$(MAKE)
-C
Documentation quick-install-man
quick-install-html
:
$(MAKE)
-C
Documentation quick-install-html
### Maintainer's dist rules
### Maintainer's dist rules
perf.spec
:
perf.spec.in
perf.spec
:
perf.spec.in
...
@@ -904,38 +792,16 @@ dist: perf.spec perf-archive$(X) configure
...
@@ -904,38 +792,16 @@ dist: perf.spec perf-archive$(X) configure
@
mkdir
-p
$(PERF_TARNAME)
@
mkdir
-p
$(PERF_TARNAME)
@
cp
perf.spec configure
$(PERF_TARNAME)
@
cp
perf.spec configure
$(PERF_TARNAME)
@
echo
$(PERF_VERSION)
>
$(PERF_TARNAME)
/version
@
echo
$(PERF_VERSION)
>
$(PERF_TARNAME)
/version
@
$(MAKE)
-C
perf-gui
TARDIR
=
../
$(PERF_TARNAME)
/perf-gui dist-version
$(TAR)
rf
$(PERF_TARNAME)
.tar
\
$(TAR)
rf
$(PERF_TARNAME)
.tar
\
$(PERF_TARNAME)
/perf.spec
\
$(PERF_TARNAME)
/perf.spec
\
$(PERF_TARNAME)
/configure
\
$(PERF_TARNAME)
/configure
\
$(PERF_TARNAME)
/version
\
$(PERF_TARNAME)
/version
$(PERF_TARNAME)
/perf-gui/version
@
$(RM)
-r
$(PERF_TARNAME)
@
$(RM)
-r
$(PERF_TARNAME)
gzip
-f
-9
$(PERF_TARNAME)
.tar
gzip
-f
-9
$(PERF_TARNAME)
.tar
rpm
:
dist
rpm
:
dist
$(RPMBUILD)
-ta
$(PERF_TARNAME)
.tar.gz
$(RPMBUILD)
-ta
$(PERF_TARNAME)
.tar.gz
htmldocs
=
perf-htmldocs-
$(PERF_VERSION)
manpages
=
perf-manpages-
$(PERF_VERSION)
dist-doc
:
$(RM)
-r
.doc-tmp-dir
mkdir
.doc-tmp-dir
$(MAKE)
-C
Documentation
WEBDOC_DEST
=
../.doc-tmp-dir install-webdoc
cd
.doc-tmp-dir
&&
$(TAR)
cf ../
$(htmldocs)
.tar .
gzip
-n
-9
-f
$(htmldocs)
.tar
:
$(RM)
-r
.doc-tmp-dir
mkdir
-p
.doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7
$(MAKE)
-C
Documentation
DESTDIR
=
./
\
man1dir
=
../.doc-tmp-dir/man1
\
man5dir
=
../.doc-tmp-dir/man5
\
man7dir
=
../.doc-tmp-dir/man7
\
install
cd
.doc-tmp-dir
&&
$(TAR)
cf ../
$(manpages)
.tar .
gzip
-n
-9
-f
$(manpages)
.tar
$(RM)
-r
.doc-tmp-dir
### Cleaning rules
### Cleaning rules
distclean
:
clean
distclean
:
clean
...
@@ -951,74 +817,13 @@ clean:
...
@@ -951,74 +817,13 @@ clean:
$(RM)
-r
$(PERF_TARNAME)
.doc-tmp-dir
$(RM)
-r
$(PERF_TARNAME)
.doc-tmp-dir
$(RM)
$(PERF_TARNAME)
.tar.gz perf-core_
$(PERF_VERSION)
-
*
.tar.gz
$(RM)
$(PERF_TARNAME)
.tar.gz perf-core_
$(PERF_VERSION)
-
*
.tar.gz
$(RM)
$(htmldocs)
.tar.gz
$(manpages)
.tar.gz
$(RM)
$(htmldocs)
.tar.gz
$(manpages)
.tar.gz
$(MAKE)
-C
Documentation/ clean
$(RM)
PERF-VERSION-FILE PERF-CFLAGS PERF-BUILD-OPTIONS
$(MAKE)
-C
templates/ clean
$(MAKE)
-C
t/ clean
ifndef
NO_TCLTK
$(MAKE)
-C
perfk-perf clean
$(MAKE)
-C
perf-gui clean
endif
$(RM)
PERF-VERSION-FILE PERF-CFLAGS PERF-GUI-VARS PERF-BUILD-OPTIONS
.PHONY
:
all install clean strip
.PHONY
:
all install clean strip
.PHONY
:
shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY
:
shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY
:
.FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
.PHONY
:
.FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
.PHONY
:
.FORCE-PERF-BUILD-OPTIONS
.PHONY
:
.FORCE-PERF-BUILD-OPTIONS
### Check documentation
#
check-docs
::
@
(
for
v
in
$(ALL_PROGRAMS)
$(BUILT_INS)
perf perfk
;
\
do
\
case
"
$$
v"
in
\
perf-merge-octopus
|
perf-merge-ours
|
perf-merge-recursive
|
\
perf-merge-resolve
|
perf-merge-subtree
|
\
perf-fsck-objects
|
perf-init-db
|
\
perf-?
*
--
?
*
)
continue
;;
\
esac
;
\
test
-f
"Documentation/
$$
v.txt"
||
\
echo
"no doc:
$$
v"
;
\
sed
-e
'/^#/d'
command-list.txt |
\
grep
-q
"^
$$
v[ ]"
||
\
case
"
$$
v"
in
\
perf
)
;;
\
*
)
echo
"no link:
$$
v"
;;
\
esac
;
\
done
;
\
(
\
sed
-e
'/^#/d'
\
-e
's/[ ].*//'
\
-e
's/^/listed /'
command-list.txt
;
\
ls
-1
Documentation/perf
*
txt |
\
sed
-e
's|Documentation/|documented |'
\
-e
's/\.txt//'
;
\
)
|
while
read
how cmd
;
\
do
\
case
"
$$
how,
$$
cmd"
in
\
*
,perf-citool
|
\
*
,perf-gui
|
\
*
,perf-help
|
\
documented,perfattributes
|
\
documented,perfignore
|
\
documented,perfmodules
|
\
documented,perfcli
|
\
documented,perf-tools
|
\
documented,perfcore-tutorial
|
\
documented,perfcvs-migration
|
\
documented,perfdiffcore
|
\
documented,perfglossary
|
\
documented,perfhooks
|
\
documented,perfrepository-layout
|
\
documented,perftutorial
|
\
documented,perftutorial-2
|
\
sentinel,not,matching,is,ok
)
continue
;;
\
esac
;
\
case
"
$(ALL_PROGRAMS)
$(BUILT_INS)
perf perfk "
in
\
*
"
$$
cmd "
*
)
;;
\
*
)
echo
"removed but
$$
how:
$$
cmd"
;;
\
esac
;
\
done
)
|
sort
### Make sure built-ins do not have dups and listed in perf.c
### Make sure built-ins do not have dups and listed in perf.c
#
#
check-builtins
::
check-builtins
::
...
...
Documentation/perf_counter/builtin-help.c
View file @
6f06ccbc
...
@@ -417,11 +417,9 @@ static void show_html_page(const char *perf_cmd)
...
@@ -417,11 +417,9 @@ static void show_html_page(const char *perf_cmd)
int
cmd_help
(
int
argc
,
const
char
**
argv
,
const
char
*
prefix
)
int
cmd_help
(
int
argc
,
const
char
**
argv
,
const
char
*
prefix
)
{
{
int
nonperf
;
const
char
*
alias
;
const
char
*
alias
;
load_command_list
(
"perf-"
,
&
main_cmds
,
&
other_cmds
);
load_command_list
(
"perf-"
,
&
main_cmds
,
&
other_cmds
);
/* setup_perf_directory_gently(&nonperf); */
perf_config
(
perf_help_config
,
NULL
);
perf_config
(
perf_help_config
,
NULL
);
argc
=
parse_options
(
argc
,
argv
,
builtin_help_options
,
argc
=
parse_options
(
argc
,
argv
,
builtin_help_options
,
...
...
Documentation/perf_counter/builtin-top.c
View file @
6f06ccbc
...
@@ -63,15 +63,6 @@
...
@@ -63,15 +63,6 @@
#include "util.h"
#include "util.h"
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <getopt.h>
#include <getopt.h>
#include <assert.h>
#include <assert.h>
#include <fcntl.h>
#include <fcntl.h>
...
@@ -103,8 +94,6 @@
...
@@ -103,8 +94,6 @@
#define PR_TASK_PERF_COUNTERS_DISABLE 31
#define PR_TASK_PERF_COUNTERS_DISABLE 31
#define PR_TASK_PERF_COUNTERS_ENABLE 32
#define PR_TASK_PERF_COUNTERS_ENABLE 32
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define rdclock() \
#define rdclock() \
({ \
({ \
struct timespec ts; \
struct timespec ts; \
...
@@ -1077,7 +1066,7 @@ static void process_event(uint64_t ip, int counter)
...
@@ -1077,7 +1066,7 @@ static void process_event(uint64_t ip, int counter)
record_ip
(
ip
,
counter
);
record_ip
(
ip
,
counter
);
}
}
static
void
process_options
(
int
argc
,
char
*
argv
[]
)
static
void
process_options
(
int
argc
,
char
*
*
argv
)
{
{
int
error
=
0
,
counter
;
int
error
=
0
,
counter
;
...
@@ -1255,7 +1244,7 @@ static void mmap_read(struct mmap_data *md)
...
@@ -1255,7 +1244,7 @@ static void mmap_read(struct mmap_data *md)
event_t
event_copy
;
event_t
event_copy
;
unsigned
in
t
size
=
event
->
header
.
size
;
size_
t
size
=
event
->
header
.
size
;
/*
/*
* Event straddles the mmap boundary -- header should always
* Event straddles the mmap boundary -- header should always
...
@@ -1301,7 +1290,7 @@ static void mmap_read(struct mmap_data *md)
...
@@ -1301,7 +1290,7 @@ static void mmap_read(struct mmap_data *md)
md
->
prev
=
old
;
md
->
prev
=
old
;
}
}
int
cmd_top
(
int
argc
,
c
onst
c
har
**
argv
,
const
char
*
prefix
)
int
cmd_top
(
int
argc
,
char
**
argv
,
const
char
*
prefix
)
{
{
struct
pollfd
event_array
[
MAX_NR_CPUS
*
MAX_COUNTERS
];
struct
pollfd
event_array
[
MAX_NR_CPUS
*
MAX_COUNTERS
];
struct
mmap_data
mmap_array
[
MAX_NR_CPUS
][
MAX_COUNTERS
];
struct
mmap_data
mmap_array
[
MAX_NR_CPUS
][
MAX_COUNTERS
];
...
...
Documentation/perf_counter/cache.h
View file @
6f06ccbc
...
@@ -94,4 +94,24 @@ static inline int is_absolute_path(const char *path)
...
@@ -94,4 +94,24 @@ static inline int is_absolute_path(const char *path)
{
{
return
path
[
0
]
==
'/'
;
return
path
[
0
]
==
'/'
;
}
}
const
char
*
make_absolute_path
(
const
char
*
path
);
const
char
*
make_nonrelative_path
(
const
char
*
path
);
const
char
*
make_relative_path
(
const
char
*
abs
,
const
char
*
base
);
int
normalize_path_copy
(
char
*
dst
,
const
char
*
src
);
int
longest_ancestor_length
(
const
char
*
path
,
const
char
*
prefix_list
);
char
*
strip_path_suffix
(
const
char
*
path
,
const
char
*
suffix
);
extern
char
*
mkpath
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
extern
char
*
perf_path
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
extern
char
*
mksnpath
(
char
*
buf
,
size_t
n
,
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
3
,
4
)));
extern
char
*
perf_snpath
(
char
*
buf
,
size_t
n
,
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
3
,
4
)));
extern
char
*
perf_pathdup
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
extern
size_t
strlcpy
(
char
*
dest
,
const
char
*
src
,
size_t
size
);
#endif
/* CACHE_H */
#endif
/* CACHE_H */
Documentation/perf_counter/config.c
View file @
6f06ccbc
...
@@ -15,7 +15,6 @@ static FILE *config_file;
...
@@ -15,7 +15,6 @@ static FILE *config_file;
static
const
char
*
config_file_name
;
static
const
char
*
config_file_name
;
static
int
config_linenr
;
static
int
config_linenr
;
static
int
config_file_eof
;
static
int
config_file_eof
;
static
int
zlib_compression_seen
;
const
char
*
config_exclusive_filename
=
NULL
;
const
char
*
config_exclusive_filename
=
NULL
;
...
@@ -533,14 +532,6 @@ static int store_aux(const char* key, const char* value, void *cb)
...
@@ -533,14 +532,6 @@ static int store_aux(const char* key, const char* value, void *cb)
return
0
;
return
0
;
}
}
static
int
write_error
(
const
char
*
filename
)
{
error
(
"failed to write new configuration file %s"
,
filename
);
/* Same error code as "failed to rename". */
return
4
;
}
static
int
store_write_section
(
int
fd
,
const
char
*
key
)
static
int
store_write_section
(
int
fd
,
const
char
*
key
)
{
{
const
char
*
dot
;
const
char
*
dot
;
...
@@ -673,7 +664,7 @@ int perf_config_set_multivar(const char* key, const char* value,
...
@@ -673,7 +664,7 @@ int perf_config_set_multivar(const char* key, const char* value,
{
{
int
i
,
dot
;
int
i
,
dot
;
int
fd
=
-
1
,
in_fd
;
int
fd
=
-
1
,
in_fd
;
int
ret
;
int
ret
=
0
;
char
*
config_filename
;
char
*
config_filename
;
const
char
*
last_dot
=
strrchr
(
key
,
'.'
);
const
char
*
last_dot
=
strrchr
(
key
,
'.'
);
...
@@ -872,90 +863,6 @@ int perf_config_set_multivar(const char* key, const char* value,
...
@@ -872,90 +863,6 @@ int perf_config_set_multivar(const char* key, const char* value,
}
}
static
int
section_name_match
(
const
char
*
buf
,
const
char
*
name
)
{
int
i
=
0
,
j
=
0
,
dot
=
0
;
for
(;
buf
[
i
]
&&
buf
[
i
]
!=
']'
;
i
++
)
{
if
(
!
dot
&&
isspace
(
buf
[
i
]))
{
dot
=
1
;
if
(
name
[
j
++
]
!=
'.'
)
break
;
for
(
i
++
;
isspace
(
buf
[
i
]);
i
++
)
;
/* do nothing */
if
(
buf
[
i
]
!=
'"'
)
break
;
continue
;
}
if
(
buf
[
i
]
==
'\\'
&&
dot
)
i
++
;
else
if
(
buf
[
i
]
==
'"'
&&
dot
)
{
for
(
i
++
;
isspace
(
buf
[
i
]);
i
++
)
;
/* do_nothing */
break
;
}
if
(
buf
[
i
]
!=
name
[
j
++
])
break
;
}
return
(
buf
[
i
]
==
']'
&&
name
[
j
]
==
0
);
}
/* if new_name == NULL, the section is removed instead */
int
perf_config_rename_section
(
const
char
*
old_name
,
const
char
*
new_name
)
{
int
ret
=
0
,
remove
=
0
;
char
*
config_filename
;
int
out_fd
;
char
buf
[
1024
];
if
(
config_exclusive_filename
)
config_filename
=
strdup
(
config_exclusive_filename
);
else
config_filename
=
perf_pathdup
(
"config"
);
if
(
out_fd
<
0
)
{
ret
=
error
(
"could not lock config file %s"
,
config_filename
);
goto
out
;
}
if
(
!
(
config_file
=
fopen
(
config_filename
,
"rb"
)))
{
/* no config file means nothing to rename, no error */
goto
unlock_and_out
;
}
while
(
fgets
(
buf
,
sizeof
(
buf
),
config_file
))
{
int
i
;
int
length
;
for
(
i
=
0
;
buf
[
i
]
&&
isspace
(
buf
[
i
]);
i
++
)
;
/* do nothing */
if
(
buf
[
i
]
==
'['
)
{
/* it's a section */
if
(
section_name_match
(
&
buf
[
i
+
1
],
old_name
))
{
ret
++
;
if
(
new_name
==
NULL
)
{
remove
=
1
;
continue
;
}
store
.
baselen
=
strlen
(
new_name
);
if
(
!
store_write_section
(
out_fd
,
new_name
))
{
goto
out
;
}
continue
;
}
remove
=
0
;
}
if
(
remove
)
continue
;
length
=
strlen
(
buf
);
if
(
write_in_full
(
out_fd
,
buf
,
length
)
!=
length
)
{
goto
out
;
}
}
fclose
(
config_file
);
unlock_and_out:
out:
free
(
config_filename
);
return
ret
;
}
/*
/*
* Call this to report error for your variable that should not
* Call this to report error for your variable that should not
* get a boolean value (i.e. "[my] var" means "true").
* get a boolean value (i.e. "[my] var" means "true").
...
...
Documentation/perf_counter/path.c
View file @
6f06ccbc
...
@@ -161,45 +161,6 @@ int perf_mkstemp(char *path, size_t len, const char *template)
...
@@ -161,45 +161,6 @@ int perf_mkstemp(char *path, size_t len, const char *template)
}
}
static
char
*
user_path
(
char
*
buf
,
char
*
path
,
int
sz
)
{
struct
passwd
*
pw
;
char
*
slash
;
int
len
,
baselen
;
if
(
!
path
||
path
[
0
]
!=
'~'
)
return
NULL
;
path
++
;
slash
=
strchr
(
path
,
'/'
);
if
(
path
[
0
]
==
'/'
||
!
path
[
0
])
{
pw
=
getpwuid
(
getuid
());
}
else
{
if
(
slash
)
{
*
slash
=
0
;
pw
=
getpwnam
(
path
);
*
slash
=
'/'
;
}
else
pw
=
getpwnam
(
path
);
}
if
(
!
pw
||
!
pw
->
pw_dir
||
sz
<=
strlen
(
pw
->
pw_dir
))
return
NULL
;
baselen
=
strlen
(
pw
->
pw_dir
);
memcpy
(
buf
,
pw
->
pw_dir
,
baselen
);
while
((
1
<
baselen
)
&&
(
buf
[
baselen
-
1
]
==
'/'
))
{
buf
[
baselen
-
1
]
=
0
;
baselen
--
;
}
if
(
slash
&&
slash
[
1
])
{
len
=
strlen
(
slash
);
if
(
sz
<=
baselen
+
len
)
return
NULL
;
memcpy
(
buf
+
baselen
,
slash
,
len
+
1
);
}
return
buf
;
}
const
char
*
make_relative_path
(
const
char
*
abs
,
const
char
*
base
)
const
char
*
make_relative_path
(
const
char
*
abs
,
const
char
*
base
)
{
{
static
char
buf
[
PATH_MAX
+
1
];
static
char
buf
[
PATH_MAX
+
1
];
...
...
Documentation/perf_counter/perf.c
View file @
6f06ccbc
#include "builtin.h"
#include "builtin.h"
#include "exec_cmd.h"
#include "exec_cmd.h"
#include "cache.h"
#include "cache.h"
//
#include "quote.h"
#include "quote.h"
#include "run-command.h"
#include "run-command.h"
const
char
perf_usage_string
[]
=
const
char
perf_usage_string
[]
=
...
@@ -132,7 +132,6 @@ static int handle_alias(int *argcp, const char ***argv)
...
@@ -132,7 +132,6 @@ static int handle_alias(int *argcp, const char ***argv)
const
char
**
new_argv
;
const
char
**
new_argv
;
const
char
*
alias_command
;
const
char
*
alias_command
;
char
*
alias_string
;
char
*
alias_string
;
int
unused_nonperf
;
alias_command
=
(
*
argv
)[
0
];
alias_command
=
(
*
argv
)[
0
];
alias_string
=
alias_lookup
(
alias_command
);
alias_string
=
alias_lookup
(
alias_command
);
...
...
Documentation/perf_counter/util.h
View file @
6f06ccbc
...
@@ -295,6 +295,20 @@ static inline char *gitstrchrnul(const char *s, int c)
...
@@ -295,6 +295,20 @@ static inline char *gitstrchrnul(const char *s, int c)
}
}
#endif
#endif
/*
* Wrappers:
*/
extern
char
*
xstrdup
(
const
char
*
str
);
extern
void
*
xmalloc
(
size_t
size
);
extern
void
*
xmemdupz
(
const
void
*
data
,
size_t
len
);
extern
char
*
xstrndup
(
const
char
*
str
,
size_t
len
);
extern
void
*
xrealloc
(
void
*
ptr
,
size_t
size
);
extern
void
*
xcalloc
(
size_t
nmemb
,
size_t
size
);
extern
void
*
xmmap
(
void
*
start
,
size_t
length
,
int
prot
,
int
flags
,
int
fd
,
off_t
offset
);
extern
ssize_t
xread
(
int
fd
,
void
*
buf
,
size_t
len
);
extern
ssize_t
xwrite
(
int
fd
,
const
void
*
buf
,
size_t
len
);
extern
int
xdup
(
int
fd
);
extern
FILE
*
xfdopen
(
int
fd
,
const
char
*
mode
);
static
inline
size_t
xsize_t
(
off_t
len
)
static
inline
size_t
xsize_t
(
off_t
len
)
{
{
return
(
size_t
)
len
;
return
(
size_t
)
len
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment