Grave o uso da CPU e crie um gráfico de linhas do Excel com a coluna "Série"

1

Eu preciso criar um gráfico de linhas para exibir o uso da CPU de cada processo ao longo do tempo. Como faço para criar o gráfico com o tempo como o eixo X,% de CPU como o eixo Y, então use o nome do comando para indicar em qual linha do gráfico os dados pertencem?

Meus dados foram criados usando o comando unix:

pidstat -hdul 1 > file.txt

Eu então reformatou os dados em csv usando este comando:

sed '1d;/^[#]/d;/^$/d;s/^[ ]*//;s/[ ]+/,/g' raw_data_file_input > nice_data_file.csv

Meus dados são organizados nas seguintes colunas:

Time, PID, %usr, %system, %guest, %CPU, CPU, KB_rd/s, KB_wr/s, KB_ccwr/s, Command

Em outras palavras, eu quero que cada comando "kjournald" seja uma linha no gráfico em vários momentos, e "gnome-panel" seja outra linha separada.

Aqui está um exemplo dos dados no formato csv:

1320713878,680,0.00,0.00,0.00,0.00,0,0.00,35.64,0.00,kjournald
1320713878,2831,1.98,1.98,0.00,3.96,0,0.00,0.00,0.00,/usr/bin/X,:0,-br,-verbose,-auth,/var/run/gdm/auth-for-gdm-LiEP18/database,-nolisten,tcp,vt7,
1320713878,4360,0.00,1.98,0.00,1.98,0,0.00,0.00,0.00,gnome-terminal,
1320713878,7897,1.98,0.00,0.00,1.98,0,0.00,0.00,0.00,gnome-panel,
1320713878,24834,0.00,0.99,0.00,0.99,0,0.00,0.00,0.00,networking,networking,file:///usr/local/src/opensplice/install/HDE/x86.linux2.6/etc/config/ospl.xml,
1320713878,24986,0.00,1.98,0.00,1.98,1,0.00,0.00,0.00,pidstat,-hdul,1,
1320713879,2426,1.00,1.00,0.00,2.00,3,0.00,0.00,0.00,/usr/bin/prltoolsd,-p,/var/run/prltoolsd.pid,
1320713879,2831,2.00,1.00,0.00,3.00,2,0.00,4.00,0.00,/usr/bin/X,:0,-br,-verbose,-auth,/var/run/gdm/auth-for-gdm-LiEP18/database,-nolisten,tcp,vt7,
1320713879,7904,14.00,0.00,0.00,14.00,1,0.00,0.00,0.00,nautilus,--no-desktop,--browser,
1320713879,24834,0.00,1.00,0.00,1.00,0,0.00,0.00,0.00,networking,networking,file:///usr/local/src/opensplice/install/HDE/x86.linux2.6/etc/config/ospl.xml,
1320713879,24992,0.00,2.00,0.00,2.00,0,0.00,0.00,0.00,/bin/sh,./killAll.sh,
1320713880,2831,0.00,1.00,0.00,1.00,1,0.00,0.00,0.00,/usr/bin/X,:0,-br,-verbose,-auth,/var/run/gdm/auth-for-gdm-LiEP18/database,-nolisten,tcp,vt7,
1320713880,3466,0.00,1.00,0.00,1.00,2,0.00,0.00,0.00,/usr/sbin/nscd,
1320713880,4129,0.00,2.00,0.00,2.00,0,0.00,0.00,0.00,/usr/bin/prl_wmouse_d,-d,
1320713880,24986,0.00,2.00,0.00,2.00,2,0.00,0.00,0.00,pidstat,-hdul,1,
1320713880,24992,0.00,2.00,0.00,2.00,3,0.00,0.00,0.00,/bin/sh,./killAll.sh,
    
por Andrew Hundt 08.11.2011 / 19:19

1 resposta

2

Não sei o quanto você está familiarizado com a ferramenta "Texto para colunas" na guia "Dados" do Excel, mas é possível usá-la rapidamente para separar seu arquivo delimitado por vírgulas.

Posso estar faltando alguma coisa, mas, parece-me que seus dados de amostra têm apenas uma instância de cada "Comando". Eu não consegui construir um gráfico de linha dependente do tempo com um único ponto de dados, então criei alguns dados "fictícios" adicionais, com valores fictícios para cada "tempo".

Uma tabela dinâmica lidará facilmente com isso. A tabela dinâmica classificará os dados e você poderá filtrá-los para mostrar apenas determinadas categorias ("Comandos", neste caso).

Depois de criar sua tabela dinâmica, você poderá clicar em qualquer lugar na tabela dinâmica e "Inserir" um gráfico. Veja abaixo.

    
por 09.11.2011 / 14:48