diff options
| author | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:25:06 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-12-08 09:25:06 -0500 |
| commit | f0b9abfb044649bc452fb2fb975ff2fd599cc6a3 (patch) | |
| tree | 7800081c5cb16a4dfee1e57a70f3be90f7b50d9a /tools/perf | |
| parent | adc1ef1e37358d3c17d1a74a58b2e104fc0bda15 (diff) | |
| parent | 1b3c393cd43f22ead8a6a2f839efc6df8ebd7465 (diff) | |
Merge branch 'linus' into perf/core
Conflicts:
tools/perf/Makefile
tools/perf/builtin-test.c
tools/perf/perf.h
tools/perf/tests/parse-events.c
tools/perf/util/evsel.h
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Makefile | 30 | ||||
| -rw-r--r-- | tools/perf/arch/x86/include/perf_regs.h | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-kvm.c | 121 | ||||
| -rw-r--r-- | tools/perf/perf.h | 15 | ||||
| -rw-r--r-- | tools/perf/tests/parse-events.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/evsel.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/header.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/header.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/pmu.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/session.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/strbuf.c | 8 |
14 files changed, 115 insertions, 81 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index a7c6aa8d4a8b..891bc77bdb2c 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -169,7 +169,35 @@ endif | |||
| 169 | 169 | ||
| 170 | ### --- END CONFIGURATION SECTION --- | 170 | ### --- END CONFIGURATION SECTION --- |
| 171 | 171 | ||
| 172 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -Iutil -I. -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 172 | ifeq ($(srctree),) |
| 173 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | ||
| 174 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 175 | #$(info Determined 'srctree' to be $(srctree)) | ||
| 176 | endif | ||
| 177 | |||
| 178 | ifneq ($(objtree),) | ||
| 179 | #$(info Determined 'objtree' to be $(objtree)) | ||
| 180 | endif | ||
| 181 | |||
| 182 | ifneq ($(OUTPUT),) | ||
| 183 | #$(info Determined 'OUTPUT' to be $(OUTPUT)) | ||
| 184 | endif | ||
| 185 | |||
| 186 | BASIC_CFLAGS = \ | ||
| 187 | -Iutil/include \ | ||
| 188 | -Iarch/$(ARCH)/include \ | ||
| 189 | $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ | ||
| 190 | -I$(srctree)/arch/$(ARCH)/include/uapi \ | ||
| 191 | -I$(srctree)/arch/$(ARCH)/include \ | ||
| 192 | $(if $(objtree),-I$(objtree)/include/generated/uapi) \ | ||
| 193 | -I$(srctree)/include/uapi \ | ||
| 194 | -I$(srctree)/include \ | ||
| 195 | -I$(OUTPUT)util \ | ||
| 196 | -Iutil \ | ||
| 197 | -I. \ | ||
| 198 | -I$(TRACE_EVENT_DIR) \ | ||
| 199 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | ||
| 200 | |||
| 173 | BASIC_LDFLAGS = | 201 | BASIC_LDFLAGS = |
| 174 | 202 | ||
| 175 | ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) | 203 | ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) |
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h index 46fc9f15c6b3..7fcdcdbee917 100644 --- a/tools/perf/arch/x86/include/perf_regs.h +++ b/tools/perf/arch/x86/include/perf_regs.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
| 5 | #include "../../util/types.h" | 5 | #include "../../util/types.h" |
| 6 | #include "../../../../../arch/x86/include/asm/perf_regs.h" | 6 | #include <asm/perf_regs.h> |
| 7 | 7 | ||
| 8 | #ifndef ARCH_X86_64 | 8 | #ifndef ARCH_X86_64 |
| 9 | #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) | 9 | #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 836c82f01371..ca3f80ebc100 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
| @@ -22,9 +22,10 @@ | |||
| 22 | #include <pthread.h> | 22 | #include <pthread.h> |
| 23 | #include <math.h> | 23 | #include <math.h> |
| 24 | 24 | ||
| 25 | #include "../../arch/x86/include/asm/svm.h" | 25 | #if defined(__i386__) || defined(__x86_64__) |
| 26 | #include "../../arch/x86/include/asm/vmx.h" | 26 | #include <asm/svm.h> |
| 27 | #include "../../arch/x86/include/asm/kvm.h" | 27 | #include <asm/vmx.h> |
| 28 | #include <asm/kvm.h> | ||
| 28 | 29 | ||
| 29 | struct event_key { | 30 | struct event_key { |
| 30 | #define INVALID_KEY (~0ULL) | 31 | #define INVALID_KEY (~0ULL) |
| @@ -58,7 +59,7 @@ struct kvm_event_key { | |||
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | 61 | ||
| 61 | struct perf_kvm; | 62 | struct perf_kvm_stat; |
| 62 | 63 | ||
| 63 | struct kvm_events_ops { | 64 | struct kvm_events_ops { |
| 64 | bool (*is_begin_event)(struct perf_evsel *evsel, | 65 | bool (*is_begin_event)(struct perf_evsel *evsel, |
| @@ -66,7 +67,7 @@ struct kvm_events_ops { | |||
| 66 | struct event_key *key); | 67 | struct event_key *key); |
| 67 | bool (*is_end_event)(struct perf_evsel *evsel, | 68 | bool (*is_end_event)(struct perf_evsel *evsel, |
| 68 | struct perf_sample *sample, struct event_key *key); | 69 | struct perf_sample *sample, struct event_key *key); |
| 69 | void (*decode_key)(struct perf_kvm *kvm, struct event_key *key, | 70 | void (*decode_key)(struct perf_kvm_stat *kvm, struct event_key *key, |
| 70 | char decode[20]); | 71 | char decode[20]); |
| 71 | const char *name; | 72 | const char *name; |
| 72 | }; | 73 | }; |
| @@ -79,7 +80,7 @@ struct exit_reasons_table { | |||
| 79 | #define EVENTS_BITS 12 | 80 | #define EVENTS_BITS 12 |
| 80 | #define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) | 81 | #define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) |
| 81 | 82 | ||
| 82 | struct perf_kvm { | 83 | struct perf_kvm_stat { |
| 83 | struct perf_tool tool; | 84 | struct perf_tool tool; |
| 84 | struct perf_session *session; | 85 | struct perf_session *session; |
| 85 | 86 | ||
| @@ -146,7 +147,7 @@ static struct exit_reasons_table svm_exit_reasons[] = { | |||
| 146 | SVM_EXIT_REASONS | 147 | SVM_EXIT_REASONS |
| 147 | }; | 148 | }; |
| 148 | 149 | ||
| 149 | static const char *get_exit_reason(struct perf_kvm *kvm, u64 exit_code) | 150 | static const char *get_exit_reason(struct perf_kvm_stat *kvm, u64 exit_code) |
| 150 | { | 151 | { |
| 151 | int i = kvm->exit_reasons_size; | 152 | int i = kvm->exit_reasons_size; |
| 152 | struct exit_reasons_table *tbl = kvm->exit_reasons; | 153 | struct exit_reasons_table *tbl = kvm->exit_reasons; |
| @@ -162,7 +163,7 @@ static const char *get_exit_reason(struct perf_kvm *kvm, u64 exit_code) | |||
| 162 | return "UNKNOWN"; | 163 | return "UNKNOWN"; |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | static void exit_event_decode_key(struct perf_kvm *kvm, | 166 | static void exit_event_decode_key(struct perf_kvm_stat *kvm, |
| 166 | struct event_key *key, | 167 | struct event_key *key, |
| 167 | char decode[20]) | 168 | char decode[20]) |
| 168 | { | 169 | { |
| @@ -228,7 +229,7 @@ static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, | |||
| 228 | return false; | 229 | return false; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | static void mmio_event_decode_key(struct perf_kvm *kvm __maybe_unused, | 232 | static void mmio_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, |
| 232 | struct event_key *key, | 233 | struct event_key *key, |
| 233 | char decode[20]) | 234 | char decode[20]) |
| 234 | { | 235 | { |
| @@ -271,7 +272,7 @@ static bool ioport_event_end(struct perf_evsel *evsel, | |||
| 271 | return kvm_entry_event(evsel); | 272 | return kvm_entry_event(evsel); |
| 272 | } | 273 | } |
| 273 | 274 | ||
| 274 | static void ioport_event_decode_key(struct perf_kvm *kvm __maybe_unused, | 275 | static void ioport_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, |
| 275 | struct event_key *key, | 276 | struct event_key *key, |
| 276 | char decode[20]) | 277 | char decode[20]) |
| 277 | { | 278 | { |
| @@ -286,7 +287,7 @@ static struct kvm_events_ops ioport_events = { | |||
| 286 | .name = "IO Port Access" | 287 | .name = "IO Port Access" |
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | static bool register_kvm_events_ops(struct perf_kvm *kvm) | 290 | static bool register_kvm_events_ops(struct perf_kvm_stat *kvm) |
| 290 | { | 291 | { |
| 291 | bool ret = true; | 292 | bool ret = true; |
| 292 | 293 | ||
| @@ -311,7 +312,7 @@ struct vcpu_event_record { | |||
| 311 | }; | 312 | }; |
| 312 | 313 | ||
| 313 | 314 | ||
| 314 | static void init_kvm_event_record(struct perf_kvm *kvm) | 315 | static void init_kvm_event_record(struct perf_kvm_stat *kvm) |
| 315 | { | 316 | { |
| 316 | unsigned int i; | 317 | unsigned int i; |
| 317 | 318 | ||
| @@ -360,7 +361,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key) | |||
| 360 | return event; | 361 | return event; |
| 361 | } | 362 | } |
| 362 | 363 | ||
| 363 | static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, | 364 | static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm, |
| 364 | struct event_key *key) | 365 | struct event_key *key) |
| 365 | { | 366 | { |
| 366 | struct kvm_event *event; | 367 | struct kvm_event *event; |
| @@ -382,7 +383,7 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, | |||
| 382 | return event; | 383 | return event; |
| 383 | } | 384 | } |
| 384 | 385 | ||
| 385 | static bool handle_begin_event(struct perf_kvm *kvm, | 386 | static bool handle_begin_event(struct perf_kvm_stat *kvm, |
| 386 | struct vcpu_event_record *vcpu_record, | 387 | struct vcpu_event_record *vcpu_record, |
| 387 | struct event_key *key, u64 timestamp) | 388 | struct event_key *key, u64 timestamp) |
| 388 | { | 389 | { |
| @@ -429,7 +430,7 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id, | |||
| 429 | return true; | 430 | return true; |
| 430 | } | 431 | } |
| 431 | 432 | ||
| 432 | static bool handle_end_event(struct perf_kvm *kvm, | 433 | static bool handle_end_event(struct perf_kvm_stat *kvm, |
| 433 | struct vcpu_event_record *vcpu_record, | 434 | struct vcpu_event_record *vcpu_record, |
| 434 | struct event_key *key, | 435 | struct event_key *key, |
| 435 | u64 timestamp) | 436 | u64 timestamp) |
| @@ -496,7 +497,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread, | |||
| 496 | return thread->priv; | 497 | return thread->priv; |
| 497 | } | 498 | } |
| 498 | 499 | ||
| 499 | static bool handle_kvm_event(struct perf_kvm *kvm, | 500 | static bool handle_kvm_event(struct perf_kvm_stat *kvm, |
| 500 | struct thread *thread, | 501 | struct thread *thread, |
| 501 | struct perf_evsel *evsel, | 502 | struct perf_evsel *evsel, |
| 502 | struct perf_sample *sample) | 503 | struct perf_sample *sample) |
| @@ -556,7 +557,7 @@ static struct kvm_event_key keys[] = { | |||
| 556 | { NULL, NULL } | 557 | { NULL, NULL } |
| 557 | }; | 558 | }; |
| 558 | 559 | ||
| 559 | static bool select_key(struct perf_kvm *kvm) | 560 | static bool select_key(struct perf_kvm_stat *kvm) |
| 560 | { | 561 | { |
| 561 | int i; | 562 | int i; |
| 562 | 563 | ||
| @@ -592,7 +593,8 @@ static void insert_to_result(struct rb_root *result, struct kvm_event *event, | |||
| 592 | rb_insert_color(&event->rb, result); | 593 | rb_insert_color(&event->rb, result); |
| 593 | } | 594 | } |
| 594 | 595 | ||
| 595 | static void update_total_count(struct perf_kvm *kvm, struct kvm_event *event) | 596 | static void |
| 597 | update_total_count(struct perf_kvm_stat *kvm, struct kvm_event *event) | ||
| 596 | { | 598 | { |
| 597 | int vcpu = kvm->trace_vcpu; | 599 | int vcpu = kvm->trace_vcpu; |
| 598 | 600 | ||
| @@ -605,7 +607,7 @@ static bool event_is_valid(struct kvm_event *event, int vcpu) | |||
| 605 | return !!get_event_count(event, vcpu); | 607 | return !!get_event_count(event, vcpu); |
| 606 | } | 608 | } |
| 607 | 609 | ||
| 608 | static void sort_result(struct perf_kvm *kvm) | 610 | static void sort_result(struct perf_kvm_stat *kvm) |
| 609 | { | 611 | { |
| 610 | unsigned int i; | 612 | unsigned int i; |
| 611 | int vcpu = kvm->trace_vcpu; | 613 | int vcpu = kvm->trace_vcpu; |
| @@ -644,7 +646,7 @@ static void print_vcpu_info(int vcpu) | |||
| 644 | pr_info("VCPU %d:\n\n", vcpu); | 646 | pr_info("VCPU %d:\n\n", vcpu); |
| 645 | } | 647 | } |
| 646 | 648 | ||
| 647 | static void print_result(struct perf_kvm *kvm) | 649 | static void print_result(struct perf_kvm_stat *kvm) |
| 648 | { | 650 | { |
| 649 | char decode[20]; | 651 | char decode[20]; |
| 650 | struct kvm_event *event; | 652 | struct kvm_event *event; |
| @@ -687,7 +689,8 @@ static int process_sample_event(struct perf_tool *tool, | |||
| 687 | struct machine *machine) | 689 | struct machine *machine) |
| 688 | { | 690 | { |
| 689 | struct thread *thread = machine__findnew_thread(machine, sample->tid); | 691 | struct thread *thread = machine__findnew_thread(machine, sample->tid); |
| 690 | struct perf_kvm *kvm = container_of(tool, struct perf_kvm, tool); | 692 | struct perf_kvm_stat *kvm = container_of(tool, struct perf_kvm_stat, |
| 693 | tool); | ||
| 691 | 694 | ||
| 692 | if (thread == NULL) { | 695 | if (thread == NULL) { |
| 693 | pr_debug("problem processing %d event, skipping it.\n", | 696 | pr_debug("problem processing %d event, skipping it.\n", |
| @@ -718,7 +721,7 @@ static int get_cpu_isa(struct perf_session *session) | |||
| 718 | return isa; | 721 | return isa; |
| 719 | } | 722 | } |
| 720 | 723 | ||
| 721 | static int read_events(struct perf_kvm *kvm) | 724 | static int read_events(struct perf_kvm_stat *kvm) |
| 722 | { | 725 | { |
| 723 | int ret; | 726 | int ret; |
| 724 | 727 | ||
| @@ -767,7 +770,7 @@ static bool verify_vcpu(int vcpu) | |||
| 767 | return true; | 770 | return true; |
| 768 | } | 771 | } |
| 769 | 772 | ||
| 770 | static int kvm_events_report_vcpu(struct perf_kvm *kvm) | 773 | static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm) |
| 771 | { | 774 | { |
| 772 | int ret = -EINVAL; | 775 | int ret = -EINVAL; |
| 773 | int vcpu = kvm->trace_vcpu; | 776 | int vcpu = kvm->trace_vcpu; |
| @@ -815,7 +818,8 @@ static const char * const record_args[] = { | |||
| 815 | _p; \ | 818 | _p; \ |
| 816 | }) | 819 | }) |
| 817 | 820 | ||
| 818 | static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) | 821 | static int |
| 822 | kvm_events_record(struct perf_kvm_stat *kvm, int argc, const char **argv) | ||
| 819 | { | 823 | { |
| 820 | unsigned int rec_argc, i, j; | 824 | unsigned int rec_argc, i, j; |
| 821 | const char **rec_argv; | 825 | const char **rec_argv; |
| @@ -838,7 +842,8 @@ static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 838 | return cmd_record(i, rec_argv, NULL); | 842 | return cmd_record(i, rec_argv, NULL); |
| 839 | } | 843 | } |
| 840 | 844 | ||
| 841 | static int kvm_events_report(struct perf_kvm *kvm, int argc, const char **argv) | 845 | static int |
| 846 | kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv) | ||
| 842 | { | 847 | { |
| 843 | const struct option kvm_events_report_options[] = { | 848 | const struct option kvm_events_report_options[] = { |
| 844 | OPT_STRING(0, "event", &kvm->report_event, "report event", | 849 | OPT_STRING(0, "event", &kvm->report_event, "report event", |
| @@ -881,24 +886,37 @@ static void print_kvm_stat_usage(void) | |||
| 881 | printf("\nOtherwise, it is the alias of 'perf stat':\n"); | 886 | printf("\nOtherwise, it is the alias of 'perf stat':\n"); |
| 882 | } | 887 | } |
| 883 | 888 | ||
| 884 | static int kvm_cmd_stat(struct perf_kvm *kvm, int argc, const char **argv) | 889 | static int kvm_cmd_stat(const char *file_name, int argc, const char **argv) |
| 885 | { | 890 | { |
| 891 | struct perf_kvm_stat kvm = { | ||
| 892 | .file_name = file_name, | ||
| 893 | |||
| 894 | .trace_vcpu = -1, | ||
| 895 | .report_event = "vmexit", | ||
| 896 | .sort_key = "sample", | ||
| 897 | |||
| 898 | .exit_reasons = svm_exit_reasons, | ||
| 899 | .exit_reasons_size = ARRAY_SIZE(svm_exit_reasons), | ||
| 900 | .exit_reasons_isa = "SVM", | ||
| 901 | }; | ||
| 902 | |||
| 886 | if (argc == 1) { | 903 | if (argc == 1) { |
| 887 | print_kvm_stat_usage(); | 904 | print_kvm_stat_usage(); |
| 888 | goto perf_stat; | 905 | goto perf_stat; |
| 889 | } | 906 | } |
| 890 | 907 | ||
| 891 | if (!strncmp(argv[1], "rec", 3)) | 908 | if (!strncmp(argv[1], "rec", 3)) |
| 892 | return kvm_events_record(kvm, argc - 1, argv + 1); | 909 | return kvm_events_record(&kvm, argc - 1, argv + 1); |
| 893 | 910 | ||
| 894 | if (!strncmp(argv[1], "rep", 3)) | 911 | if (!strncmp(argv[1], "rep", 3)) |
| 895 | return kvm_events_report(kvm, argc - 1 , argv + 1); | 912 | return kvm_events_report(&kvm, argc - 1 , argv + 1); |
| 896 | 913 | ||
| 897 | perf_stat: | 914 | perf_stat: |
| 898 | return cmd_stat(argc, argv, NULL); | 915 | return cmd_stat(argc, argv, NULL); |
| 899 | } | 916 | } |
| 917 | #endif | ||
| 900 | 918 | ||
| 901 | static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | 919 | static int __cmd_record(const char *file_name, int argc, const char **argv) |
| 902 | { | 920 | { |
| 903 | int rec_argc, i = 0, j; | 921 | int rec_argc, i = 0, j; |
| 904 | const char **rec_argv; | 922 | const char **rec_argv; |
| @@ -907,7 +925,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 907 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 925 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 908 | rec_argv[i++] = strdup("record"); | 926 | rec_argv[i++] = strdup("record"); |
| 909 | rec_argv[i++] = strdup("-o"); | 927 | rec_argv[i++] = strdup("-o"); |
| 910 | rec_argv[i++] = strdup(kvm->file_name); | 928 | rec_argv[i++] = strdup(file_name); |
| 911 | for (j = 1; j < argc; j++, i++) | 929 | for (j = 1; j < argc; j++, i++) |
| 912 | rec_argv[i] = argv[j]; | 930 | rec_argv[i] = argv[j]; |
| 913 | 931 | ||
| @@ -916,7 +934,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 916 | return cmd_record(i, rec_argv, NULL); | 934 | return cmd_record(i, rec_argv, NULL); |
| 917 | } | 935 | } |
| 918 | 936 | ||
| 919 | static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | 937 | static int __cmd_report(const char *file_name, int argc, const char **argv) |
| 920 | { | 938 | { |
| 921 | int rec_argc, i = 0, j; | 939 | int rec_argc, i = 0, j; |
| 922 | const char **rec_argv; | 940 | const char **rec_argv; |
| @@ -925,7 +943,7 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 925 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 943 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 926 | rec_argv[i++] = strdup("report"); | 944 | rec_argv[i++] = strdup("report"); |
| 927 | rec_argv[i++] = strdup("-i"); | 945 | rec_argv[i++] = strdup("-i"); |
| 928 | rec_argv[i++] = strdup(kvm->file_name); | 946 | rec_argv[i++] = strdup(file_name); |
| 929 | for (j = 1; j < argc; j++, i++) | 947 | for (j = 1; j < argc; j++, i++) |
| 930 | rec_argv[i] = argv[j]; | 948 | rec_argv[i] = argv[j]; |
| 931 | 949 | ||
| @@ -934,7 +952,8 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 934 | return cmd_report(i, rec_argv, NULL); | 952 | return cmd_report(i, rec_argv, NULL); |
| 935 | } | 953 | } |
| 936 | 954 | ||
| 937 | static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | 955 | static int |
| 956 | __cmd_buildid_list(const char *file_name, int argc, const char **argv) | ||
| 938 | { | 957 | { |
| 939 | int rec_argc, i = 0, j; | 958 | int rec_argc, i = 0, j; |
| 940 | const char **rec_argv; | 959 | const char **rec_argv; |
| @@ -943,7 +962,7 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 943 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 962 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 944 | rec_argv[i++] = strdup("buildid-list"); | 963 | rec_argv[i++] = strdup("buildid-list"); |
| 945 | rec_argv[i++] = strdup("-i"); | 964 | rec_argv[i++] = strdup("-i"); |
| 946 | rec_argv[i++] = strdup(kvm->file_name); | 965 | rec_argv[i++] = strdup(file_name); |
| 947 | for (j = 1; j < argc; j++, i++) | 966 | for (j = 1; j < argc; j++, i++) |
| 948 | rec_argv[i] = argv[j]; | 967 | rec_argv[i] = argv[j]; |
| 949 | 968 | ||
| @@ -954,20 +973,12 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 954 | 973 | ||
| 955 | int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) | 974 | int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) |
| 956 | { | 975 | { |
| 957 | struct perf_kvm kvm = { | 976 | const char *file_name; |
| 958 | .trace_vcpu = -1, | ||
| 959 | .report_event = "vmexit", | ||
| 960 | .sort_key = "sample", | ||
| 961 | |||
| 962 | .exit_reasons = svm_exit_reasons, | ||
| 963 | .exit_reasons_size = ARRAY_SIZE(svm_exit_reasons), | ||
| 964 | .exit_reasons_isa = "SVM", | ||
| 965 | }; | ||
| 966 | 977 | ||
| 967 | const struct option kvm_options[] = { | 978 | const struct option kvm_options[] = { |
| 968 | OPT_STRING('i', "input", &kvm.file_name, "file", | 979 | OPT_STRING('i', "input", &file_name, "file", |
| 969 | "Input file name"), | 980 | "Input file name"), |
| 970 | OPT_STRING('o', "output", &kvm.file_name, "file", | 981 | OPT_STRING('o', "output", &file_name, "file", |
| 971 | "Output file name"), | 982 | "Output file name"), |
| 972 | OPT_BOOLEAN(0, "guest", &perf_guest, | 983 | OPT_BOOLEAN(0, "guest", &perf_guest, |
| 973 | "Collect guest os data"), | 984 | "Collect guest os data"), |
| @@ -1002,32 +1013,34 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 1002 | if (!perf_host) | 1013 | if (!perf_host) |
| 1003 | perf_guest = 1; | 1014 | perf_guest = 1; |
| 1004 | 1015 | ||
| 1005 | if (!kvm.file_name) { | 1016 | if (!file_name) { |
| 1006 | if (perf_host && !perf_guest) | 1017 | if (perf_host && !perf_guest) |
| 1007 | kvm.file_name = strdup("perf.data.host"); | 1018 | file_name = strdup("perf.data.host"); |
| 1008 | else if (!perf_host && perf_guest) | 1019 | else if (!perf_host && perf_guest) |
| 1009 | kvm.file_name = strdup("perf.data.guest"); | 1020 | file_name = strdup("perf.data.guest"); |
| 1010 | else | 1021 | else |
| 1011 | kvm.file_name = strdup("perf.data.kvm"); | 1022 | file_name = strdup("perf.data.kvm"); |
| 1012 | 1023 | ||
| 1013 | if (!kvm.file_name) { | 1024 | if (!file_name) { |
| 1014 | pr_err("Failed to allocate memory for filename\n"); | 1025 | pr_err("Failed to allocate memory for filename\n"); |
| 1015 | return -ENOMEM; | 1026 | return -ENOMEM; |
| 1016 | } | 1027 | } |
| 1017 | } | 1028 | } |
| 1018 | 1029 | ||
| 1019 | if (!strncmp(argv[0], "rec", 3)) | 1030 | if (!strncmp(argv[0], "rec", 3)) |
| 1020 | return __cmd_record(&kvm, argc, argv); | 1031 | return __cmd_record(file_name, argc, argv); |
| 1021 | else if (!strncmp(argv[0], "rep", 3)) | 1032 | else if (!strncmp(argv[0], "rep", 3)) |
| 1022 | return __cmd_report(&kvm, argc, argv); | 1033 | return __cmd_report(file_name, argc, argv); |
| 1023 | else if (!strncmp(argv[0], "diff", 4)) | 1034 | else if (!strncmp(argv[0], "diff", 4)) |
| 1024 | return cmd_diff(argc, argv, NULL); | 1035 | return cmd_diff(argc, argv, NULL); |
| 1025 | else if (!strncmp(argv[0], "top", 3)) | 1036 | else if (!strncmp(argv[0], "top", 3)) |
| 1026 | return cmd_top(argc, argv, NULL); | 1037 | return cmd_top(argc, argv, NULL); |
| 1027 | else if (!strncmp(argv[0], "buildid-list", 12)) | 1038 | else if (!strncmp(argv[0], "buildid-list", 12)) |
| 1028 | return __cmd_buildid_list(&kvm, argc, argv); | 1039 | return __cmd_buildid_list(file_name, argc, argv); |
| 1040 | #if defined(__i386__) || defined(__x86_64__) | ||
| 1029 | else if (!strncmp(argv[0], "stat", 4)) | 1041 | else if (!strncmp(argv[0], "stat", 4)) |
| 1030 | return kvm_cmd_stat(&kvm, argc, argv); | 1042 | return kvm_cmd_stat(file_name, argc, argv); |
| 1043 | #endif | ||
| 1031 | else | 1044 | else |
| 1032 | usage_with_options(kvm_usage, kvm_options); | 1045 | usage_with_options(kvm_usage, kvm_options); |
| 1033 | 1046 | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index f53ee0bbee88..2c340e7da458 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
| @@ -5,8 +5,9 @@ struct winsize; | |||
| 5 | 5 | ||
| 6 | void get_term_dimensions(struct winsize *ws); | 6 | void get_term_dimensions(struct winsize *ws); |
| 7 | 7 | ||
| 8 | #include <asm/unistd.h> | ||
| 9 | |||
| 8 | #if defined(__i386__) | 10 | #if defined(__i386__) |
| 9 | #include "../../arch/x86/include/asm/unistd.h" | ||
| 10 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 11 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
| 11 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 12 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 12 | #define CPUINFO_PROC "model name" | 13 | #define CPUINFO_PROC "model name" |
| @@ -16,7 +17,6 @@ void get_term_dimensions(struct winsize *ws); | |||
| 16 | #endif | 17 | #endif |
| 17 | 18 | ||
| 18 | #if defined(__x86_64__) | 19 | #if defined(__x86_64__) |
| 19 | #include "../../arch/x86/include/asm/unistd.h" | ||
| 20 | #define rmb() asm volatile("lfence" ::: "memory") | 20 | #define rmb() asm volatile("lfence" ::: "memory") |
| 21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 22 | #define CPUINFO_PROC "model name" | 22 | #define CPUINFO_PROC "model name" |
| @@ -33,13 +33,11 @@ void get_term_dimensions(struct winsize *ws); | |||
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #ifdef __s390__ | 35 | #ifdef __s390__ |
| 36 | #include "../../arch/s390/include/asm/unistd.h" | ||
| 37 | #define rmb() asm volatile("bcr 15,0" ::: "memory") | 36 | #define rmb() asm volatile("bcr 15,0" ::: "memory") |
| 38 | #define cpu_relax() asm volatile("" ::: "memory"); | 37 | #define cpu_relax() asm volatile("" ::: "memory"); |
| 39 | #endif | 38 | #endif |
| 40 | 39 | ||
| 41 | #ifdef __sh__ | 40 | #ifdef __sh__ |
| 42 | #include "../../arch/sh/include/asm/unistd.h" | ||
| 43 | #if defined(__SH4A__) || defined(__SH5__) | 41 | #if defined(__SH4A__) || defined(__SH5__) |
| 44 | # define rmb() asm volatile("synco" ::: "memory") | 42 | # define rmb() asm volatile("synco" ::: "memory") |
| 45 | #else | 43 | #else |
| @@ -50,35 +48,30 @@ void get_term_dimensions(struct winsize *ws); | |||
| 50 | #endif | 48 | #endif |
| 51 | 49 | ||
| 52 | #ifdef __hppa__ | 50 | #ifdef __hppa__ |
| 53 | #include "../../arch/parisc/include/asm/unistd.h" | ||
| 54 | #define rmb() asm volatile("" ::: "memory") | 51 | #define rmb() asm volatile("" ::: "memory") |
| 55 | #define cpu_relax() asm volatile("" ::: "memory"); | 52 | #define cpu_relax() asm volatile("" ::: "memory"); |
| 56 | #define CPUINFO_PROC "cpu" | 53 | #define CPUINFO_PROC "cpu" |
| 57 | #endif | 54 | #endif |
| 58 | 55 | ||
| 59 | #ifdef __sparc__ | 56 | #ifdef __sparc__ |
| 60 | #include "../../arch/sparc/include/uapi/asm/unistd.h" | ||
| 61 | #define rmb() asm volatile("":::"memory") | 57 | #define rmb() asm volatile("":::"memory") |
| 62 | #define cpu_relax() asm volatile("":::"memory") | 58 | #define cpu_relax() asm volatile("":::"memory") |
| 63 | #define CPUINFO_PROC "cpu" | 59 | #define CPUINFO_PROC "cpu" |
| 64 | #endif | 60 | #endif |
| 65 | 61 | ||
| 66 | #ifdef __alpha__ | 62 | #ifdef __alpha__ |
| 67 | #include "../../arch/alpha/include/asm/unistd.h" | ||
| 68 | #define rmb() asm volatile("mb" ::: "memory") | 63 | #define rmb() asm volatile("mb" ::: "memory") |
| 69 | #define cpu_relax() asm volatile("" ::: "memory") | 64 | #define cpu_relax() asm volatile("" ::: "memory") |
| 70 | #define CPUINFO_PROC "cpu model" | 65 | #define CPUINFO_PROC "cpu model" |
| 71 | #endif | 66 | #endif |
| 72 | 67 | ||
| 73 | #ifdef __ia64__ | 68 | #ifdef __ia64__ |
| 74 | #include "../../arch/ia64/include/asm/unistd.h" | ||
| 75 | #define rmb() asm volatile ("mf" ::: "memory") | 69 | #define rmb() asm volatile ("mf" ::: "memory") |
| 76 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") | 70 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") |
| 77 | #define CPUINFO_PROC "model name" | 71 | #define CPUINFO_PROC "model name" |
| 78 | #endif | 72 | #endif |
| 79 | 73 | ||
| 80 | #ifdef __arm__ | 74 | #ifdef __arm__ |
| 81 | #include "../../arch/arm/include/asm/unistd.h" | ||
| 82 | /* | 75 | /* |
| 83 | * Use the __kuser_memory_barrier helper in the CPU helper page. See | 76 | * Use the __kuser_memory_barrier helper in the CPU helper page. See |
| 84 | * arch/arm/kernel/entry-armv.S in the kernel source for details. | 77 | * arch/arm/kernel/entry-armv.S in the kernel source for details. |
| @@ -89,13 +82,11 @@ void get_term_dimensions(struct winsize *ws); | |||
| 89 | #endif | 82 | #endif |
| 90 | 83 | ||
| 91 | #ifdef __aarch64__ | 84 | #ifdef __aarch64__ |
| 92 | #include "../../arch/arm64/include/asm/unistd.h" | ||
| 93 | #define rmb() asm volatile("dmb ld" ::: "memory") | 85 | #define rmb() asm volatile("dmb ld" ::: "memory") |
| 94 | #define cpu_relax() asm volatile("yield" ::: "memory") | 86 | #define cpu_relax() asm volatile("yield" ::: "memory") |
| 95 | #endif | 87 | #endif |
| 96 | 88 | ||
| 97 | #ifdef __mips__ | 89 | #ifdef __mips__ |
| 98 | #include "../../arch/mips/include/asm/unistd.h" | ||
| 99 | #define rmb() asm volatile( \ | 90 | #define rmb() asm volatile( \ |
| 100 | ".set mips2\n\t" \ | 91 | ".set mips2\n\t" \ |
| 101 | "sync\n\t" \ | 92 | "sync\n\t" \ |
| @@ -112,7 +103,7 @@ void get_term_dimensions(struct winsize *ws); | |||
| 112 | #include <sys/types.h> | 103 | #include <sys/types.h> |
| 113 | #include <sys/syscall.h> | 104 | #include <sys/syscall.h> |
| 114 | 105 | ||
| 115 | #include "../../include/uapi/linux/perf_event.h" | 106 | #include <linux/perf_event.h> |
| 116 | #include "util/types.h" | 107 | #include "util/types.h" |
| 117 | #include <stdbool.h> | 108 | #include <stdbool.h> |
| 118 | 109 | ||
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 42a0c8cd3cd5..32ee478905eb 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | #include "evsel.h" | 3 | #include "evsel.h" |
| 4 | #include "evlist.h" | 4 | #include "evlist.h" |
| 5 | #include "sysfs.h" | 5 | #include "sysfs.h" |
| 6 | #include "../../../include/linux/hw_breakpoint.h" | ||
| 7 | #include "tests.h" | 6 | #include "tests.h" |
| 7 | #include <linux/hw_breakpoint.h> | ||
| 8 | 8 | ||
| 9 | #define TEST_ASSERT_VAL(text, cond) \ | 9 | #define TEST_ASSERT_VAL(text, cond) \ |
| 10 | do { \ | 10 | do { \ |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1fb636c550a1..1b16dd1edc8e 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #include "cpumap.h" | 18 | #include "cpumap.h" |
| 19 | #include "thread_map.h" | 19 | #include "thread_map.h" |
| 20 | #include "target.h" | 20 | #include "target.h" |
| 21 | #include "../../../include/linux/hw_breakpoint.h" | 21 | #include <linux/hw_breakpoint.h> |
| 22 | #include "../../../include/uapi/linux/perf_event.h" | 22 | #include <linux/perf_event.h> |
| 23 | #include "perf_regs.h" | 23 | #include "perf_regs.h" |
| 24 | 24 | ||
| 25 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) | 25 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index a4c1dd4e149f..3d2b8017438c 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
| 6 | #include <stddef.h> | 6 | #include <stddef.h> |
| 7 | #include "../../../include/uapi/linux/perf_event.h" | 7 | #include <linux/perf_event.h> |
| 8 | #include "types.h" | 8 | #include "types.h" |
| 9 | #include "xyarray.h" | 9 | #include "xyarray.h" |
| 10 | #include "cgroup.h" | 10 | #include "cgroup.h" |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 195a47a8f052..b7da4634a047 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -1379,6 +1379,8 @@ static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused, | |||
| 1379 | 1379 | ||
| 1380 | str = tmp + 1; | 1380 | str = tmp + 1; |
| 1381 | fprintf(fp, "# node%u cpu list : %s\n", c, str); | 1381 | fprintf(fp, "# node%u cpu list : %s\n", c, str); |
| 1382 | |||
| 1383 | str += strlen(str) + 1; | ||
| 1382 | } | 1384 | } |
| 1383 | return; | 1385 | return; |
| 1384 | error: | 1386 | error: |
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index 5f1cd6884f37..20f0344accb1 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef __PERF_HEADER_H | 1 | #ifndef __PERF_HEADER_H |
| 2 | #define __PERF_HEADER_H | 2 | #define __PERF_HEADER_H |
| 3 | 3 | ||
| 4 | #include "../../../include/uapi/linux/perf_event.h" | 4 | #include <linux/perf_event.h> |
| 5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
| 6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
| 7 | #include "types.h" | 7 | #include "types.h" |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 020323af3364..2d8d53bec17e 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #include "../../../include/linux/hw_breakpoint.h" | 1 | #include <linux/hw_breakpoint.h> |
| 2 | #include "util.h" | 2 | #include "util.h" |
| 3 | #include "../perf.h" | 3 | #include "../perf.h" |
| 4 | #include "evlist.h" | 4 | #include "evlist.h" |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index f6399373d67d..b7af80b8bdda 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
| 8 | #include <stdbool.h> | 8 | #include <stdbool.h> |
| 9 | #include "types.h" | 9 | #include "types.h" |
| 10 | #include "../../../include/uapi/linux/perf_event.h" | 10 | #include <linux/perf_event.h> |
| 11 | #include "types.h" | 11 | #include "types.h" |
| 12 | 12 | ||
| 13 | struct list_head; | 13 | struct list_head; |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 07d553fe8d83..a313ed76a49a 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define __PMU_H | 2 | #define __PMU_H |
| 3 | 3 | ||
| 4 | #include <linux/bitops.h> | 4 | #include <linux/bitops.h> |
| 5 | #include "../../../include/uapi/linux/perf_event.h" | 5 | #include <linux/perf_event.h> |
| 6 | 6 | ||
| 7 | enum { | 7 | enum { |
| 8 | PERF_PMU_FORMAT_VALUE_CONFIG, | 8 | PERF_PMU_FORMAT_VALUE_CONFIG, |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 18d1222b05a2..cea133a6bdf1 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "symbol.h" | 8 | #include "symbol.h" |
| 9 | #include "thread.h" | 9 | #include "thread.h" |
| 10 | #include <linux/rbtree.h> | 10 | #include <linux/rbtree.h> |
| 11 | #include "../../../include/uapi/linux/perf_event.h" | 11 | #include <linux/perf_event.h> |
| 12 | 12 | ||
| 13 | struct sample_queue; | 13 | struct sample_queue; |
| 14 | struct ip_callchain; | 14 | struct ip_callchain; |
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index 2eeb51baf077..cfa906882e2c 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c | |||
| @@ -90,17 +90,17 @@ void strbuf_addf(struct strbuf *sb, const char *fmt, ...) | |||
| 90 | if (!strbuf_avail(sb)) | 90 | if (!strbuf_avail(sb)) |
| 91 | strbuf_grow(sb, 64); | 91 | strbuf_grow(sb, 64); |
| 92 | va_start(ap, fmt); | 92 | va_start(ap, fmt); |
| 93 | len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); | 93 | len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); |
| 94 | va_end(ap); | 94 | va_end(ap); |
| 95 | if (len < 0) | 95 | if (len < 0) |
| 96 | die("your vscnprintf is broken"); | 96 | die("your vsnprintf is broken"); |
| 97 | if (len > strbuf_avail(sb)) { | 97 | if (len > strbuf_avail(sb)) { |
| 98 | strbuf_grow(sb, len); | 98 | strbuf_grow(sb, len); |
| 99 | va_start(ap, fmt); | 99 | va_start(ap, fmt); |
| 100 | len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); | 100 | len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); |
| 101 | va_end(ap); | 101 | va_end(ap); |
| 102 | if (len > strbuf_avail(sb)) { | 102 | if (len > strbuf_avail(sb)) { |
| 103 | die("this should not happen, your snprintf is broken"); | 103 | die("this should not happen, your vsnprintf is broken"); |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | strbuf_setlen(sb, sb->len + len); | 106 | strbuf_setlen(sb, sb->len + len); |
