]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/performance/27_io/fmtflags_manipulators.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / performance / 27_io / fmtflags_manipulators.cc
CommitLineData
83ffe9cd 1// Copyright (C) 2004-2023 Free Software Foundation, Inc.
a2af66c1
PC
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
748086b7 6// Free Software Foundation; either version 3, or (at your option)
a2af66c1
PC
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
748086b7
JJ
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
a2af66c1 17
a2af66c1
PC
18
19#include <cstdlib>
20#include <sstream>
21#include <testsuite_performance.h>
22
23// libstdc++/14078
24int main(int argc, char** argv)
25{
26 using namespace std;
27 using namespace __gnu_test;
28
29 time_counter time;
30 resource_counter resource;
31
32 int iters = 50000000;
33 if (argc > 1)
34 iters = atoi(argv[1]);
35
36 ostringstream os_s, os_m;
37
38 // setf
39 start_counters(time, resource);
40 for (int i = 0; i < iters; ++i)
41 {
42 os_s.setf(ios_base::uppercase);
43 os_s.unsetf(ios_base::uppercase);
44 }
45 stop_counters(time, resource);
46 report_performance(__FILE__, "setf", time, resource);
47 clear_counters(time, resource);
48
49 // manipulator
50 start_counters(time, resource);
51 for (int i = 0; i < iters; ++i)
52 {
53 os_m << uppercase;
54 os_m << nouppercase;
55 }
56 stop_counters(time, resource);
57 report_performance(__FILE__, "manipulator", time, resource);
58
59 return 0;
60}