4
3

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 5 years have passed since last update.

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

Last updated at Posted at 2015-04-05

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

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

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
(以下続く)

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

4
3
2

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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?