第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

從 Go 代碼調(diào)用 typeperf 以接收系統(tǒng)信息

從 Go 代碼調(diào)用 typeperf 以接收系統(tǒng)信息

Go
郎朗坤 2023-04-24 16:28:08
我正在嘗試獲取進(jìn)程列表,包括它們的當(dāng)前負(fù)載。 typeperf "\Process(*)\% Processor Time" -sc 1似乎給了我想要的輸出。從作品中執(zhí)行cmd?,F(xiàn)在我嘗試從我的 Go 代碼中調(diào)用該命令// Command to list processescmdPS := exec.Command("typeperf", "\"\\Process(*)\\% Processor Time\"", "-sc", "1")cmdPS.Stdout = &buffcmdPS.Stderr = &errBufferr := cmdPS.Run()if err != nil {    log.Printf("Err: %s", buff.String())    return nil, errors.Wrapf(err, "Failed to call: ps ax -o")}這導(dǎo)致:Exiting, please wait...Error: No valid counters.Note:  In order to use typeperf, you must either be a member of the local  Performance Log Users group, or the command must be executed from an  elevated command window.我格式化命令字符串的方式有誤嗎?我希望直接執(zhí)行此命令并通過 Go 執(zhí)行它會(huì)以相同的權(quán)限運(yùn)行。
查看完整描述

1 回答

?
慕婉清6462132

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個(gè)贊

看起來您需要?jiǎng)h除轉(zhuǎn)義引號(hào)。shell(或本例中的 cmd)將為您處理參數(shù)。

但是,typeperf "\Process(*)\% Processor Time" -sc 1 在我的機(jī)器上運(yùn)行以下結(jié)果。

Error: No valid counters.

Note:
  In order to use typeperf, you must either be a member of the local
  Performance Log Users group, or the command must be executed from an
  elevated command window.


查看完整回答
反對(duì) 回復(fù) 2023-04-24
  • 1 回答
  • 0 關(guān)注
  • 236 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)