2 atlc - arbitrary transmission line calculator, for the analysis of
3 transmission lines are directional couplers.
5 Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
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.
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.
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,
22 Dr. David Kirkby, e-mail drkirkby@ntlworld.com
25 /* Try to get data. This will work only on a HP-UX machine. */
30 #ifdef HAVE_SYS_PARAM_H /* This looks for header files that should be */
31 #ifdef HAVE_SYS_PSTAT_H /* present on HP-UX. If they are all present */
32 #ifdef HAVE_STDIO_H /* it does ***not** necessarily mean it's HP-UX */
33 #ifdef HAVE_STDLIB_H /* but it will define some variables that we */
34 #ifdef HAVE_SYS_TYPES_H /* later check for, to confirm it's HP-UX */
37 #ifdef HAVE_SYS_UTSNAME_H
39 #include <sys/param.h> /* Include the header files */
40 #include <sys/pstat.h>
43 #include <sys/types.h>
46 #include <sys/unistd.h>
47 #include <sys/utsname.h>
49 extern long _CPU_REVISION;
50 extern long _FPU_MODEL;
59 #endif /* End of including header files likely to be on HP-UX system */
61 #define BYTES_PER_MB 1048576
64 int try_hpux(struct computer_data *data)
67 #ifdef HAVE_SYS_PARAM_H
68 #ifdef HAVE_SYS_PSTAT_H
71 #ifdef HAVE_SYS_TYPES_H
74 #ifdef HAVE_SYS_UTSNAME_H
77 #ifdef HAVE_PSTAT_GETDYNAMIC /* Check for some HP-UX specific bits now */
78 #ifdef HAVE_PSTAT_GETPROCESSOR
81 long max_CPUs=0, CPUs_online=0;
82 double clock_speed_in_Hz, ram, scclktick;
84 struct pst_dynamic dynamic_hpux;
85 struct pst_static static_hpux;
86 struct pst_processor psp;
88 /* Obtain the maximum number of CPUs supported on the HP-UX system */
90 pstat_getdynamic(&dynamic_hpux,(size_t) sizeof(dynamic_hpux),1,0);
91 max_CPUs=(long) dynamic_hpux.psd_max_proc_cnt;
93 sprintf(data->max_cpus,"%ld",max_CPUs);
95 /* Obtain the number of CPUs online on the HP-UXs system */
96 CPUs_online=(long) dynamic_hpux.psd_proc_cnt; ;
97 if( CPUs_online >= 1 )
98 sprintf(data->cpus,"%ld",CPUs_online);
100 /* Obtain the of CPU and FPU on the HP-UX box */
102 sprintf(data->cpu_type,"%ld",_CPU_REVISION);
103 sprintf(data->fpu_type,"%ld",_FPU_MODEL);
105 /* Obtain the RAM on the HP-UX system */
107 pstat_getstatic(&static_hpux,(size_t) sizeof(static_hpux),1,0);
108 ram=(double) static_hpux.physical_memory;
109 ram*=(double) static_hpux.page_size;
110 ram=ram/(double) BYTES_PER_MB;
111 sprintf(data->memory,"%ld",(long) (0.5+ram));
114 /* Obtain the processor speed */
115 pstat_getprocessor(&psp, sizeof(psp), 1, 0);
116 scclktick=(double) sysconf(_SC_CLK_TCK);
117 clock_speed_in_Hz = ((double) psp.psp_iticksperclktick) * scclktick;
118 if(clock_speed_in_Hz > 1)
119 sprintf(data->mhz,"%.1f",clock_speed_in_Hz/1000000);