Imported Upstream version 4.6.0
[debian/atlc] / tests / try_unicos.c
1 /*
2 atlc - arbitrary transmission line calculator, for the analysis of
3 transmission lines are directional couplers. 
4
5 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either package_version 2
10 of the License, or (at your option) any later package_version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
20 USA.
21
22 Dr. David Kirkby, e-mail drkirkby@ntlworld.com 
23
24 */
25 #include "config.h"
26
27 #include "defs.h"
28
29 #ifdef HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
32
33 int try_unicos(struct computer_data *data)
34 {
35 #ifdef _SC_CRAY_NCPU
36   static char *mftype[] = {"?", "?", "?", "X-MP", "?", \
37   "Y-MP", "2","C90???","C90_or_Y16","T4_or_T16_or_T32"};
38
39   long CPUs_online=0, cpu_cycle_time_in_ps;
40   double clock_speed_in_MHz;
41   double ram;
42
43   /* Obtain the maximum number of CPUs supported on the UNICOS system */
44
45   /* Obtain the number of CPUs online on the UNICOS system */
46   CPUs_online=0;
47   CPUs_online=sysconf(_SC_CRAY_NCPU);
48   if( CPUs_online >= 1 )
49     sprintf(data->cpus,"%ld",CPUs_online);
50
51
52   /* Obtain the speed of the Cray machine. */
53 #ifdef _SC_CRAY_CPCYCLE
54   if((cpu_cycle_time_in_ps=sysconf(_SC_CRAY_CPCYCLE)) > 0)
55   {
56       sprintf(data->mhz,"%.1f",1e6/cpu_cycle_time_in_ps);
57   }
58 #endif
59
60   /* Obtain the RAM on the UNICOS system */
61
62
63   /* Obtain the manufacturer */
64   strcpy(data->hw_provider,"Cray");
65
66   /* Obtain the Platform */
67 #ifdef _SC_CRAY_MFTYPE
68   if (sysconf(_SC_CRAY_MFTYPE) <= 9L)
69     strcpy(data->hw_platform,mftype[sysconf(_SC_CRAY_MFTYPE)] );
70 #endif
71
72   return(PROBABLY_UNICOS);
73 #endif
74   return(-1);
75 }