0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

vmstatのデータをVBAで取り込もう①

Posted at

vmstatのデータをVBAで取り込む

準備

テキストにvmstatのデータを出力されていること
vmstatのデータ準備

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
2  0      0 481508   2216 688484    0    0   361    65  229  402 12 12 93  4  0
2  0      0 481508   2216 688484    0    0   361    65  229  402 22 22 93  4  0
2  0      0 481508   2216 688484    0    0   361    65  229  402 32 32 93  4  0
2  0      0 481508   2216 688484    0    0   361    65  229  402 42 42 93  4  0
2  0      0 481508   2216 688484    0    0   361    65  229  402 52 52 93  4  0
2  0      0 481508   2216 688484    0    0   361    65  229  402 62 62 93  4  0

vbaマクロ

Sub test()

Open "C:\Users\zzz\OneDrive\デスクトップ\vba\vmstat.txt" For Input As #1

  Do Until EOF(1)
    Line Input #1, buf
    
    zzz = Left(buf, 2)
    
    
    Select Case zzz
    
      Case p, r
    
        ' 何もしない
      Case 1 To 99
      
        tmp = Split(buf, " ")
        
        MsgBox tmp(33)
        MsgBox tmp(34)
        MsgBox tmp(35)
        
        
    End Select
    
    
    
  Loop

Close #1

End Sub

vmstatのデータをVBAで取り込もう②に続く予定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?