diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 15:40:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-03 15:40:46 -0400 |
commit | 7447d56217e215e50317f308aee1ed293ac4f749 (patch) | |
tree | 903832ecb206ae83160992c6aec40c624821941f /tools/lib | |
parent | 892ad5acca0b2ddb514fae63fa4686bf726d2471 (diff) | |
parent | 23acd3e1a0a377cf3730ccb753aa1fdc50378396 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"Most of the changes are for tooling, the main changes in this cycle were:
- Improve Intel-PT hardware tracing support, both on the kernel and
on the tooling side: PTWRITE instruction support, power events for
C-state tracing, etc. (Adrian Hunter)
- Add support to measure SMI cost to the x86 architecture, with
tooling support in 'perf stat' (Kan Liang)
- Support function filtering in 'perf ftrace', plus related
improvements (Namhyung Kim)
- Allow adding and removing fields to the default 'perf script'
columns, using + or - as field prefixes to do so (Andi Kleen)
- Allow resolving the DSO name with 'perf script -F brstack{sym,off},dso'
(Mark Santaniello)
- Add perf tooling unwind support for PowerPC (Paolo Bonzini)
- ... and various other improvements as well"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (84 commits)
perf auxtrace: Add CPU filter support
perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC
perf intel-pt: Update documentation to include new ptwrite and power events
perf intel-pt: Add example script for power events and PTWRITE
perf intel-pt: Synthesize new power and "ptwrite" events
perf intel-pt: Move code in intel_pt_synth_events() to simplify attr setting
perf intel-pt: Factor out intel_pt_set_event_name()
perf intel-pt: Tidy messages into called function intel_pt_synth_event()
perf intel-pt: Tidy Intel PT evsel lookup into separate function
perf intel-pt: Join needlessly wrapped lines
perf intel-pt: Remove unused instructions_sample_period
perf intel-pt: Factor out common code synthesizing event samples
perf script: Add synthesized Intel PT power and ptwrite events
perf/x86/intel: Constify the 'lbr_desc[]' array and make a function static
perf script: Add 'synth' field for synthesized event payloads
perf auxtrace: Add itrace option to output power events
perf auxtrace: Add itrace option to output ptwrite events
tools include: Add byte-swapping macros to kernel.h
perf script: Add 'synth' event type for synthesized events
x86/insn: perf tools: Add new ptwrite instruction
...
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/api/fs/fs.c | 30 | ||||
-rw-r--r-- | tools/lib/api/fs/fs.h | 4 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c index 809c7721cd24..a7ecf8f469f4 100644 --- a/tools/lib/api/fs/fs.c +++ b/tools/lib/api/fs/fs.c | |||
@@ -387,6 +387,22 @@ int filename__read_str(const char *filename, char **buf, size_t *sizep) | |||
387 | return err; | 387 | return err; |
388 | } | 388 | } |
389 | 389 | ||
390 | int filename__write_int(const char *filename, int value) | ||
391 | { | ||
392 | int fd = open(filename, O_WRONLY), err = -1; | ||
393 | char buf[64]; | ||
394 | |||
395 | if (fd < 0) | ||
396 | return err; | ||
397 | |||
398 | sprintf(buf, "%d", value); | ||
399 | if (write(fd, buf, sizeof(buf)) == sizeof(buf)) | ||
400 | err = 0; | ||
401 | |||
402 | close(fd); | ||
403 | return err; | ||
404 | } | ||
405 | |||
390 | int procfs__read_str(const char *entry, char **buf, size_t *sizep) | 406 | int procfs__read_str(const char *entry, char **buf, size_t *sizep) |
391 | { | 407 | { |
392 | char path[PATH_MAX]; | 408 | char path[PATH_MAX]; |
@@ -480,3 +496,17 @@ int sysctl__read_int(const char *sysctl, int *value) | |||
480 | 496 | ||
481 | return filename__read_int(path, value); | 497 | return filename__read_int(path, value); |
482 | } | 498 | } |
499 | |||
500 | int sysfs__write_int(const char *entry, int value) | ||
501 | { | ||
502 | char path[PATH_MAX]; | ||
503 | const char *sysfs = sysfs__mountpoint(); | ||
504 | |||
505 | if (!sysfs) | ||
506 | return -1; | ||
507 | |||
508 | if (snprintf(path, sizeof(path), "%s/%s", sysfs, entry) >= PATH_MAX) | ||
509 | return -1; | ||
510 | |||
511 | return filename__write_int(path, value); | ||
512 | } | ||
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h index 956c21127d1e..45605348461e 100644 --- a/tools/lib/api/fs/fs.h +++ b/tools/lib/api/fs/fs.h | |||
@@ -31,6 +31,8 @@ int filename__read_int(const char *filename, int *value); | |||
31 | int filename__read_ull(const char *filename, unsigned long long *value); | 31 | int filename__read_ull(const char *filename, unsigned long long *value); |
32 | int filename__read_str(const char *filename, char **buf, size_t *sizep); | 32 | int filename__read_str(const char *filename, char **buf, size_t *sizep); |
33 | 33 | ||
34 | int filename__write_int(const char *filename, int value); | ||
35 | |||
34 | int procfs__read_str(const char *entry, char **buf, size_t *sizep); | 36 | int procfs__read_str(const char *entry, char **buf, size_t *sizep); |
35 | 37 | ||
36 | int sysctl__read_int(const char *sysctl, int *value); | 38 | int sysctl__read_int(const char *sysctl, int *value); |
@@ -38,4 +40,6 @@ int sysfs__read_int(const char *entry, int *value); | |||
38 | int sysfs__read_ull(const char *entry, unsigned long long *value); | 40 | int sysfs__read_ull(const char *entry, unsigned long long *value); |
39 | int sysfs__read_str(const char *entry, char **buf, size_t *sizep); | 41 | int sysfs__read_str(const char *entry, char **buf, size_t *sizep); |
40 | int sysfs__read_bool(const char *entry, bool *value); | 42 | int sysfs__read_bool(const char *entry, bool *value); |
43 | |||
44 | int sysfs__write_int(const char *entry, int value); | ||
41 | #endif /* __API_FS__ */ | 45 | #endif /* __API_FS__ */ |