Help us understand the problem. What is going on with this article?

簡便なSafariとChromeのメモリ使用量の測定方法

More than 3 years have passed since last update.

結局どちらがメモリ使用量が低いの?!ということでしばらく監視することに。

以下の様なシェルスクリプトを書きました。

safari_vs_chrome.sh
#!/bin/bash

logfile="./safari_vs_chrome.log"

while sleep 1; do

    now=`date +%S`
    surplus=`expr $now % 10`
    if [ $surplus -eq 0 ];then
        echo 'Date                Safari  Chrome' > $logfile
    fi

    echo `date "+%Y-%m-%d %H:%M:%S"` \
    `ps aux | grep Safari | awk '{sum += \$6}END{print sum}'` \
    `ps aux | grep Chrome | awk '{sum += \$6}END{print sum}'` > $logfile
done

これを以下のように実行して、

$ sh safari_vs_chrome.sh &

以下のように見ましょう。

$ tail -f safari_vs_chrome.log

こんなかんじで出てきます。

2015-04-05 11:04:14 926424 874976
2015-04-05 11:04:15 926372 874972
2015-04-05 11:04:17 926380 874952
2015-04-05 11:04:18 926412 874952
2015-04-05 11:04:19 926456 874952
Date                Safari  Chrome
2015-04-05 11:04:20 926536 874952
2015-04-05 11:04:21 926484 874944
2015-04-05 11:04:22 926628 874960
(以下続く)

測定だけはこれで可能だけど、開いているページや数によって大きく変わってくるので、実験はきちんと条件を揃えないといけませんね。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした