~ubuntu-branches/ubuntu/vivid/atlas/vivid

« back to all changes in this revision

Viewing changes to CONFIG/archinfo_hpux.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-04-13 10:07:52 UTC
  • Revision ID: james.westby@ubuntu.com-20020413100752-va9zm0rd4gpurdkq
Tags: upstream-3.2.1ln
ImportĀ upstreamĀ versionĀ 3.2.1ln

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *             Automatically Tuned Linear Algebra Software v3.2
 
3
 *                    (C) Copyright 2000 R. Clint Whaley                     
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *   1. Redistributions of source code must retain the above copyright
 
9
 *      notice, this list of conditions and the following disclaimer.
 
10
 *   2. Redistributions in binary form must reproduce the above copyright
 
11
 *      notice, this list of conditions, and the following disclaimer in the
 
12
 *      documentation and/or other materials provided with the distribution.
 
13
 *   3. The name of the University of Tennessee, the ATLAS group,
 
14
 *      or the names of its contributers may not be used to endorse
 
15
 *      or promote products derived from this software without specific
 
16
 *      written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 
19
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 
20
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
21
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE
 
22
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
23
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
24
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
25
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
26
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
27
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
28
 * POSSIBILITY OF SUCH DAMAGE. 
 
29
 *
 
30
 */
 
31
 
 
32
#include <stdio.h>
 
33
enum WHATPROBE {Pcpu, Pnproc, Pl1, Pl2, Ptlb, Pall};
 
34
 
 
35
PrintUsage(char *nam)
 
36
{
 
37
   fprintf(stderr, "USAGE: %s -c (cpu) -n (#procs) -1 (L1 cache) -2 (L2 cache) -t (# of tlb)\n\n", nam);
 
38
   exit(1);
 
39
}
 
40
 
 
41
enum WHATPROBE GetFlags(int nargs, char **args)
 
42
{
 
43
   int i;
 
44
   enum WHATPROBE ret=Pall;
 
45
 
 
46
   if (nargs > 2) PrintUsage(args[0]);
 
47
   if (nargs > 1)
 
48
   {
 
49
      if (args[1][0] != '-') PrintUsage(args[0]);
 
50
      switch(args[1][1])
 
51
      {
 
52
      case 'c':
 
53
         ret = Pcpu;
 
54
         break;
 
55
      case 'n':
 
56
         ret = Pnproc;
 
57
         break;
 
58
      case '1':
 
59
         ret = Pl1;
 
60
         break;
 
61
      case '2':
 
62
         ret = Pl2;
 
63
         break;
 
64
      case 't':
 
65
         ret = Ptlb;
 
66
         break;
 
67
      default:
 
68
         ret = Pall;
 
69
      }
 
70
   }
 
71
   return(ret);
 
72
}
 
73
 
 
74
main(int nargs, char **args)
 
75
{
 
76
   enum WHATPROBE what;
 
77
   int ncpu;
 
78
 
 
79
   what = GetFlags(nargs, args);
 
80
   switch(what)
 
81
   {
 
82
   case Pnproc:
 
83
      ncpu = syscall(315, 1);
 
84
      printf("ncpus = %d\n", ncpu);
 
85
      break;
 
86
   default:
 
87
      fprintf(stderr, "Not implemented\n");
 
88
      exit(-1);
 
89
   }
 
90
   exit(0);
 
91
}