aboutsummaryrefslogtreecommitdiff
path: root/benchtests/sprintf-source.c
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2015-05-21 10:01:34 -0400
committerCarlos O'Donell <carlos@systemhalted.org>2015-05-21 10:02:52 -0400
commit608f897106eb10d3b250fae88478b3b1ac3999d5 (patch)
tree60c56f5149287bc597771ed8a57ff47d25ed9d3f /benchtests/sprintf-source.c
parent2212c1420c92a33b0e0bd9a34938c9814a56c0f7 (diff)
downloadglibc-608f897106eb10d3b250fae88478b3b1ac3999d5.tar
glibc-608f897106eb10d3b250fae88478b3b1ac3999d5.tar.gz
glibc-608f897106eb10d3b250fae88478b3b1ac3999d5.tar.bz2
glibc-608f897106eb10d3b250fae88478b3b1ac3999d5.zip
Add sprintf benchmark.
Tests position and non-positional arguments with two test string.
Diffstat (limited to 'benchtests/sprintf-source.c')
-rw-r--r--benchtests/sprintf-source.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/benchtests/sprintf-source.c b/benchtests/sprintf-source.c
new file mode 100644
index 0000000000..29ea6c6a89
--- /dev/null
+++ b/benchtests/sprintf-source.c
@@ -0,0 +1,6 @@
+/* A set of arbitrarily selected positional format specifiers. */
+#define FORMAT1 " %1$d: %2$c%3$c%4$c%5$c%6$c %7$20s %8$f (%9$02x)\n"
+/* A matching, but arbitrarily selected, set of non-positional format specifiers. */
+#define FORMAT2 " %d: %c%c%c%c%c %20s %f (%02x)\n"
+/* Sufficiently large buffer. */
+char buf[256];