diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-03-22 14:09:08 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-03-22 14:09:08 -0400 |
commit | 0d09eb7a9a2ca4d7ed32f7b440bea78c0622814a (patch) | |
tree | 177871323b183610017c65c68f0bde9af2f37f47 /tools/perf/util/hist.c | |
parent | 9521d830b6341d1887dcfc2aebde23fbfa5f1473 (diff) | |
parent | 89c5bd08df5841326abbf167d136bcf14cf759ed (diff) |
Merge branch 'perf/urgent' into perf/core
Merge Reason: to pick the fix:
commit e7f01d1
perf tools: Use scnprintf where applicable
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r-- | tools/perf/util/hist.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2c624ad371a7..5fb19013ca0c 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -840,7 +840,7 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
840 | sep ? "%.2f" : " %6.2f%%", | 840 | sep ? "%.2f" : " %6.2f%%", |
841 | (period * 100.0) / total); | 841 | (period * 100.0) / total); |
842 | else | 842 | else |
843 | ret = snprintf(s, size, sep ? "%.2f" : " %6.2f%%", | 843 | ret = scnprintf(s, size, sep ? "%.2f" : " %6.2f%%", |
844 | (period * 100.0) / total); | 844 | (period * 100.0) / total); |
845 | if (symbol_conf.show_cpu_utilization) { | 845 | if (symbol_conf.show_cpu_utilization) { |
846 | ret += percent_color_snprintf(s + ret, size - ret, | 846 | ret += percent_color_snprintf(s + ret, size - ret, |
@@ -863,20 +863,20 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
863 | } | 863 | } |
864 | } | 864 | } |
865 | } else | 865 | } else |
866 | ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); | 866 | ret = scnprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); |
867 | 867 | ||
868 | if (symbol_conf.show_nr_samples) { | 868 | if (symbol_conf.show_nr_samples) { |
869 | if (sep) | 869 | if (sep) |
870 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); | 870 | ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
871 | else | 871 | else |
872 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); | 872 | ret += scnprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
873 | } | 873 | } |
874 | 874 | ||
875 | if (symbol_conf.show_total_period) { | 875 | if (symbol_conf.show_total_period) { |
876 | if (sep) | 876 | if (sep) |
877 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 877 | ret += scnprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); |
878 | else | 878 | else |
879 | ret += snprintf(s + ret, size - ret, " %12" PRIu64, period); | 879 | ret += scnprintf(s + ret, size - ret, " %12" PRIu64, period); |
880 | } | 880 | } |
881 | 881 | ||
882 | if (pair_hists) { | 882 | if (pair_hists) { |
@@ -891,25 +891,25 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s, | |||
891 | diff = new_percent - old_percent; | 891 | diff = new_percent - old_percent; |
892 | 892 | ||
893 | if (fabs(diff) >= 0.01) | 893 | if (fabs(diff) >= 0.01) |
894 | snprintf(bf, sizeof(bf), "%+4.2F%%", diff); | 894 | ret += scnprintf(bf, sizeof(bf), "%+4.2F%%", diff); |
895 | else | 895 | else |
896 | snprintf(bf, sizeof(bf), " "); | 896 | ret += scnprintf(bf, sizeof(bf), " "); |
897 | 897 | ||
898 | if (sep) | 898 | if (sep) |
899 | ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf); | 899 | ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf); |
900 | else | 900 | else |
901 | ret += snprintf(s + ret, size - ret, "%11.11s", bf); | 901 | ret += scnprintf(s + ret, size - ret, "%11.11s", bf); |
902 | 902 | ||
903 | if (show_displacement) { | 903 | if (show_displacement) { |
904 | if (displacement) | 904 | if (displacement) |
905 | snprintf(bf, sizeof(bf), "%+4ld", displacement); | 905 | ret += scnprintf(bf, sizeof(bf), "%+4ld", displacement); |
906 | else | 906 | else |
907 | snprintf(bf, sizeof(bf), " "); | 907 | ret += scnprintf(bf, sizeof(bf), " "); |
908 | 908 | ||
909 | if (sep) | 909 | if (sep) |
910 | ret += snprintf(s + ret, size - ret, "%c%s", *sep, bf); | 910 | ret += scnprintf(s + ret, size - ret, "%c%s", *sep, bf); |
911 | else | 911 | else |
912 | ret += snprintf(s + ret, size - ret, "%6.6s", bf); | 912 | ret += scnprintf(s + ret, size - ret, "%6.6s", bf); |
913 | } | 913 | } |
914 | } | 914 | } |
915 | 915 | ||
@@ -927,7 +927,7 @@ int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size, | |||
927 | if (se->elide) | 927 | if (se->elide) |
928 | continue; | 928 | continue; |
929 | 929 | ||
930 | ret += snprintf(s + ret, size - ret, "%s", sep ?: " "); | 930 | ret += scnprintf(s + ret, size - ret, "%s", sep ?: " "); |
931 | ret += se->se_snprintf(he, s + ret, size - ret, | 931 | ret += se->se_snprintf(he, s + ret, size - ret, |
932 | hists__col_len(hists, se->se_width_idx)); | 932 | hists__col_len(hists, se->se_width_idx)); |
933 | } | 933 | } |