OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [performance/] [27_io/] [ifstream_getline.cc] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009
2
// Free Software Foundation, Inc.
3
//
4
// This file is part of the GNU ISO C++ Library.  This library is free
5
// software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the
7
// Free Software Foundation; either version 3, or (at your option)
8
// any later version.
9
 
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
 
15
// You should have received a copy of the GNU General Public License along
16
// with this library; see the file COPYING3.  If not see
17
// <http://www.gnu.org/licenses/>.
18
 
19
 
20
#include <fstream>
21
#include <cstdlib>
22
#include <testsuite_performance.h>
23
 
24
// libstdc++/5001 (100,000 line input file)
25
int main ()
26
{
27
  using namespace std;
28
  using namespace __gnu_test;
29
 
30
  time_counter time;
31
  resource_counter resource;
32
 
33
  const char* name1 = "/usr/share/dict/words";
34
  const char* name2 = "/usr/share/dict/linux.words";
35
  ifstream in;
36
  in.open(name1);
37
  if (!in.is_open())
38
    {
39
      in.clear();
40
      in.open(name2);
41
    }
42
  if (!in.is_open())
43
    exit(1);
44
 
45
  char buffer[BUFSIZ];
46
  start_counters(time, resource);
47
  while (in.good())
48
    in.getline(buffer, BUFSIZ);
49
  stop_counters(time, resource);
50
  report_performance(__FILE__, "", time, resource);
51
 
52
  return 0;
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.