Sponsored Content
Top Forums Shell Programming and Scripting writing a simple script to get total number of cpus/cores in server Post 302591497 by Corona688 on Thursday 19th of January 2012 04:11:49 PM
Old 01-19-2012
Quote:
Originally Posted by steven12
what I am trying to do is display number of cpu and cores for each cpu and multiplying both to get total number of cores in the server.
Why bother? Each core shows up individually whether it's in a separate processor or not, just count them.
Code:
awk '/^processor/ { N++} END { print N }' /proc/cpuinfo

Besides, how do you know each CPU has the same number of cores?

To extract both:

Code:
awk -F: '/^physical/ && !ID[$2] { P++; ID[$2]=1 }; /^physical/ { N++ };  END { print N, P }' /proc/cpuinfo

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help writing simple script

I'm trying to write a simple unix script that will delete files after 30 days of being created. I've never done this before but conceptually it sounds easy. Here is what I'm trying to do: Get System Date Get File Date If (sysdate-filedate>30days) rm file All of these files are contained... (1 Reply)
Discussion started by: tamdoankc
1 Replies

2. UNIX for Dummies Questions & Answers

HELP! writing simple shell script

how would i write a shell script to show the number of lines in which int variable appears in a c++ program. (3 Replies)
Discussion started by: deadleg
3 Replies

3. Shell Programming and Scripting

Need Script to Use CPUs on a HPUX server to simulate Workload Manager on HPUX.

I am running HPUX and using WLM (workload manager). I want to write a script to fork CPUs to basically take CPUs from other servers to show that the communication is working and CPU licensing is working. Basically, I want to build a script that will use up CPU on a server. Any ideas? (2 Replies)
Discussion started by: cpolikowsky
2 Replies

4. Shell Programming and Scripting

Help with writing simple bash script

I want to write a bash script to: 1. Send an email from localhost to an external gmail account. (gmail then automatically forwards the message back to a pop account on the same server. 2. Script waits 3 minutes then checks to see if the email arrived, and if not, it sends an email to... (9 Replies)
Discussion started by: sallyanne
9 Replies

5. Shell Programming and Scripting

problem writing a simple c shell script

#!/bin/csh echo hello world this is what i got in a text file called ss1. i type "chmod 755 ss1.txt" to make it executable. then when i type ss1 or ss1.txt it says "ss1 command not found" what am i doing wrong? (19 Replies)
Discussion started by: pantelis
19 Replies

6. Shell Programming and Scripting

Total number of users logged in a server from uptime

how to find out total number of users logged in a server from uptime . i mean to say i need the total output of unix command . who gives the out put at a particular time . I need at all time from which machine who has connected , (3 Replies)
Discussion started by: amiya.te@gmail
3 Replies

7. UNIX and Linux Applications

Looking to reduce the number a cpus available for SGE

Hey all Im looking to reduce the number of cpus available on a certain node in our cluster available for jobs using SGE. i.e. we have one node that has 24 cpus available for jobs on SGE, i would like to reduce that to 16. Thanks (1 Reply)
Discussion started by: olifu02
1 Replies

8. Red Hat

Control Cores/CPUs used in Linux instance on VMware

We have a production setup where we have RHEL instances on VMware. We have 2 RHEL instances on VMware now each having 4 CPUs/cores each. I want to put up another RHEL instance but my query is that can we allocate only 1 CPU/core for the new instance. I hope, my query is clear that can we... (3 Replies)
Discussion started by: RHCE
3 Replies

9. Solaris

How to calculate total number of cores on my servers ?

Hi, I want to get total number of cores on my all non-global zones on Solaris 10. I got two methods and both are giving different results. Below link is a script, which tells me that total cores are 8 Mandalika's scratchpad: Oracle Solaris: Show Me the CPU, vCPU, Core Counts and the... (4 Replies)
Discussion started by: ron323232
4 Replies

10. Solaris

Calculating number of CPUs in Solaris-8

Hello, I have few old V210/V240, running Solaris-8. I am trying to find, number of physical CPUs, number of cores and number of virtual processors. psrinfo is giving me confusing status. It looks like, there are 2 physical CPUs, but psrinfo -p shows me just 1 bash-2.03$ psrinfo -v Status of... (4 Replies)
Discussion started by: ron323232
4 Replies
ppuconfig(1M)															     ppuconfig(1M)

NAME
ppuconfig - configure Pay per use daemon SYNOPSIS
DESCRIPTION
is a tool for configuring communication between the Pay per use daemon (see ppud(1M)) and a utility meter. A utility meter must be speci- fied for a Pay per use system before the daemon will collect and send utilization data to HP. In the absence of this data, HP may assume 100% utilization and bill for the system accordingly. If is invoked without any options, the current settings will be displayed. After initially configuring the utility meter with the command, use the ppuconfig -t command to perform a round trip communication test with the meter and to perform other validation checks. If the daemon is not running, this command will start the daemon. When is used to modify the configuration information related to the utility meter, it is not necessary to restart the daemon. When config- uration information is modified also use to verify the new configuration. can be used to place a cap on the number of active cores, thereby limiting the maximum utilization reported to HP. This option is not allowed in a virtual partition environment. For more information see the Pay per use User's Guide located at /usr/share/doc/PayPerUseUserGuide.pdf Options recognizes the following command-line options and arguments: Specifies the number of cores that should be active on this partition the next time it boots. Upon the next partition reboot, cores may be deactivated until this value is reached. Specification of the value "all" means that all cores that can be active, should be active. "all" is the default cap. To specify a cap and make it take effect immediately, specify the option in conjunction with the option. Note: the option does not apply to virtual partitions. To limit the number of active cores in a virtual partition, use the vpar- modify(1M) command to assign or unassign cores. Specifies that the hostname should be used as the system identifier for the Pay per use system when reporting usage information. Specifies the utility meter that the Pay per use system should use for reporting usage data. The meter can be specified as a fully qualified hostname or IP address. A non-blank value is required. Reconcile. Instructs to activate or deactivate cores to get to the specified cap value. will only deactivate cores from the default proces- sor set (pset 0) and will never deactivate the last core in a cell or the last core in the partition. Note: this option does not apply to virtual partitions. Specifies the system identifier that the Pay per use system should use when reporting. This can be any value that helps you identify this system (for example, a tracking number, asset number, physi- cal location, etc). Until a system identifier is specified, the hostname will be used by default. This identifier is transmit- ted to HP and shows up on the Utility Pricing Solutions portal (http://www.hp.com/go/payperuse) to help you identify your system. Perform a communication test between Pay per use software and the configured utility meter. Perform other validation checks to make sure PPU information can be acquired. Start the ppud daemon if it is not running. RETURN VALUES
exits with one of these values: Success Failure; error message sent to EXAMPLES
The following example shows configuration of the utility meter to a system called alpha.corp.com followed by a communication test of that meter. ppuconfig -m alpha.corp.com ppuconfig -t The following example shows how to cap the number of active cores to three and make it take effect immediately. ppuconfig -rc 3 The following example shows how to remove a cap from the system and always have all cores active. ppuconfig -c all The following example shows how to set the system ID for this system. The system ID can be any text that helps you better identify your system. ppuconfig -s "rp8410 in bldg 7 1st floor system room: ID#234879" AUTHORS
ppuconfig was developed by HP. FILES
/etc/ppu/ppu_config File containing utility meter configuration data. If this file is removed, the daemon will not be started at system boot and utilization data will not be transmitted to HP. /var/ppu/PPUReport.xml File created every 30 minutes containing a report of the core utilization over the last 30 minutes for this partition. SEE ALSO
ppud(1M), ppu(5) ppuconfig(1M)
All times are GMT -4. The time now is 01:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy