自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

獲得 AIX系統(tǒng)中處理器資源的代碼示例

系統(tǒng) 其他OS
在 AIX系統(tǒng)5.3 和 6.1 上測試通過,我們文章中給出的一段基于 Perl 的例子代碼可以偵測當(dāng)前的AIX系統(tǒng)環(huán)境和 CPU 的類型和數(shù)量。

本段的***給出一段基于 Perl 的例子代碼,在 AIX系統(tǒng)5.3 和 6.1 上測試通過,可以偵測當(dāng)前的AIX系統(tǒng)環(huán)境和 CPU 的類型和數(shù)量。這段代碼首先運(yùn)行系統(tǒng)命令 oslevel 得到當(dāng)前系統(tǒng)的版本,如果是 AIX6.1 則運(yùn)行命令 lparstat 判斷當(dāng)前系統(tǒng)是否為 WPAR。

無論 AIX 系統(tǒng)的版本如何,都加參數(shù) -i 運(yùn)行命令 lparstat 來獲得分區(qū)的個(gè)數(shù),并以此判斷是否使用了微分區(qū)技術(shù)。***調(diào)用命令 prtconf 輸出 CPU 的一些參數(shù)。

該段代碼可以幫助用戶快速了解當(dāng)前環(huán)境,尤其適用于工作環(huán)境復(fù)雜或頻繁變更的場景。需要指出的是對(duì)于使用了微分區(qū)技術(shù)的系統(tǒng),代碼的***輸出的是虛擬處理器的數(shù)量。需要了解AIX系統(tǒng)中物理處理器和邏輯處理器狀態(tài)的用戶,可以參閱本文其他段落加以補(bǔ)充。

清單 4. 獲得當(dāng)前的AIX系統(tǒng)環(huán)境和 CPU 的類型和數(shù)量的代碼示例
     

  1. # WPAR 僅存在于 AIX 6.1 系統(tǒng)  
  2. my $oslevel =  `oslevel`;   
  3. if ($oslevel =~ m/6\.1/)   
  4. {   
  5. # 在 WPAR 中不帶參數(shù)運(yùn)行 lparstat 命令只返回警告信息  
  6. my $output = `lparstat`;   
  7. if ($output =~ m/The output is applicable only to the Global Environment/)   
  8. {   
  9. print "This machine is one WPAR with following CPU assigned.\n";   
  10. system ("prtconf | grep Processor");   
  11. exit 0;   
  12. }   
  13. }   
  14.  
  15. # 使用– i 參數(shù)列出詳細(xì)的配置信息  
  16. my @outputs = `lparstat -i`;   
  17. foreach my $line (@outputs)   
  18. {   
  19. # 解析命令輸出并得到分區(qū)個(gè)數(shù)  
  20. if ($line !~ m/Partition Number/) {next;}   
  21. my ($blank, $partition_num) = split /Partition Number\s+:\s/, $line;   
  22. chomp $partition_num;   
  23. if ($partition_num eq '-') # full system 環(huán)境沒有劃分微分區(qū)  
  24. {   
  25. print "This machine is one full system without LPARs. The system has following   
  26. physical CPUs installed.\n";   
  27. }elsif ($partition_num > 1) # 如果存在多于一個(gè)的分區(qū),該AIX系統(tǒng)使用了微分區(qū)技術(shù)  
  28. {   
  29. print "This machine is one LPAR with virtual following CPUs installed.   
  30. To check the assignment of physical CPU, please log on HMC or AMM.\n";   
  31. }else   
  32. {   
  33. print "Can not decide whether current environment is one LPAR or not.   
  34. Please check HMC or AMM to decide this.\n";   
  35. }   
  36. }   
  37. # 打印處理器本身的參數(shù)  
  38. system ("prtconf | grep Processor");   
  39. exit 0;   

這樣,在AIX系統(tǒng)中獲得處理器資源的知識(shí)我們就講解完畢。

【編輯推薦】

  1. 講解如何來使用AIX svmon
  2. 怎樣靈活運(yùn)用AIX vmstat
  3. AIX操作系統(tǒng)知識(shí)講解
  4. 使用Unix scp 在主機(jī)之間復(fù)制文件
  5. AIX內(nèi)存調(diào)整命令簡介
責(zé)任編輯:小霞
相關(guān)推薦

2010-09-30 11:03:43

AMD皓龍6100渠道

2010-04-23 12:35:17

2012-11-27 14:44:59

英特爾100核處理器

2020-06-16 08:50:10

CPU處理器感線程管理

2012-01-10 09:32:12

iOS 5.1設(shè)備四核處理器

2010-04-22 18:17:29

Aix系統(tǒng)故障

2009-03-24 22:02:38

多核處理器設(shè)計(jì)

2010-04-22 15:27:40

Aix操作系統(tǒng)

2014-09-09 09:49:59

2010-07-15 15:56:46

AIX TELNET命

2012-11-13 15:35:36

AMD服務(wù)器處理器阿布扎比

2024-01-31 08:09:53

預(yù)處理器代碼C++

2023-11-07 14:30:21

微處理器CPU

2017-10-12 13:00:22

LinuxRISC-V多核開源處理器

2009-01-03 15:20:11

ibmdwAIX

2009-03-01 21:30:46

Mac OS X 10Nehalem處理器

2010-04-27 18:24:56

AIX CPU

2009-12-23 10:11:49

Linux操作系統(tǒng)

2009-12-04 14:23:05

Windows7操作系

2011-12-14 01:14:43

處理器數(shù)據(jù)庫11gOracle
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)