Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/tcmalloc/chromium/src/gmail-send-self-test

Issue 7865021: Deep-Memory-Profiler (DMP) implementation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed bugs Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tcmalloc/chromium/src/dmprof ('k') | third_party/tcmalloc/chromium/src/heap-profile-table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/gmail-send-self-test
diff --git a/third_party/tcmalloc/chromium/src/gmail-send-self-test b/third_party/tcmalloc/chromium/src/gmail-send-self-test
new file mode 100755
index 0000000000000000000000000000000000000000..669d053bc4b19a8a78ee249b3cbd0331c8c96c7f
--- /dev/null
+++ b/third_party/tcmalloc/chromium/src/gmail-send-self-test
@@ -0,0 +1,162 @@
+#!/bin/bash
+
+# Account setting that will be used in the testing.
+# Any account with keyboard-shortcuts enabled can be used.
+account=chromememorytest
+password=bigmemory
+
+chrome=$(pwd)/out/Debug/chrome # chrome binary
+outdir=$(pwd)/o$$ # output directory
+heapdir=$outdir/heap/ # where to dump logs
+datadir=$outdir/data/ # for user data
+dumptime=30 # seconds between dumps
+
+ctrl() {
+ if [ -z "$2" ]
+ then
+ xte <<EOF
+keydown Control_L
+str $1
+keyup Control_L
+EOF
+ else
+ [ "x$1" == "xshift" ] || exit 7
+ xte <<EOF
+keydown Control_L
+usleep 150000
+keydown Shift_L
+usleep 150000
+str $2
+keyup Shift_L
+keyup Control_L
+EOF
+ fi
+}
+
+body() {
+ sleep 1
+ for j in `seq 1 50`;do
+ xte "str test-word$j "
+ done
+ xte "key Return"
+ xte "key Return"
+ xte "str John"
+}
+
+purge_memory() {
+ sleep 1
+
+ xte <<EOF
+keydown Shift_L
+usleep 150000
+key Escape
+usleep 150000
+keyup Shift_L
+EOF
+
+ sleep 1
+ xte "key Tab"
+ sleep 1
+ xte "key Tab"
+ sleep 1
+ xte "key Tab"
+ sleep 1
+ xte "key Return"
+ sleep 1
+ ctrl w
+ sleep 3
+}
+
+data0=$(for i in `seq 1 100`; do echo -n $i; done)
+data1=$(sed "s/1/ a /g" <<<$data0)
+data2=$(sed "s/3/ c /g" <<<$data1)
+
+mkdir $outdir || exit 3
+mkdir $heapdir || exit 3
+echo Writing output to $outdir
+
+echo initial chrome start
+$chrome --no-sandbox --user-data-dir=$datadir >& /dev/null &
+
+# Dismiss "which search engine?" choice
+sleep 2
+xte "key Tab"
+xte "key Return"
+sleep 5
+
+ctrl l
+ctrl w
+sleep 1
+ctrl shift q
+
+echo chrome start
+sleep 5
+HEAPPROFILE=$heapdir/hprof HEAP_PROFILE_MMAP=true HEAP_PROFILE_TIME_INTERVAL=$dumptime $chrome --no-sandbox --user-data-dir=$datadir --password-store=basic --purge-memory-button www.gmail.com >& $outdir/browser-output &
+#$chrome --no-sandbox --user-data-dir=$datadir --password-store=basic --purge-memory-button www.gmail.com >& $outdir/browser-output &
+
+
+# Must log in with username/password (necessary cookie ain't there, for whatever reason)
+sleep 10
+
+xte "str $account"
+sleep 1
+xte "key Tab"
+sleep 1
+xte "str $password"
+sleep 1
+xte "key Return"
+
+sleep 25
+
+cd $outdir || exit 5
+
+for i in $(seq 1 100); do
+ echo $i
+
+ #if [ $((i % 20)) -eq 1 ]
+ #then
+ # sleep 300
+ #fi
+
+ xte "str uc" && sleep 5
+ xte "str ${account}@gmail.com," && sleep 4
+
+ if [ $((i % 10)) -eq 1 ]
+ then
+
+ # Here we click purge-memory button
+ ctrl t && sleep 2
+ purge_memory
+ ctrl w && sleep 2
+
+ # Save about:memory
+ ctrl t && xte "str about:memory" && xte "key Return" && sleep 4
+ import -window root screenshot${i}.png
+ ctrl s && sleep 2 && xte "str `pwd`/am$i" && xte "key Return" && sleep 3
+ ctrl w && sleep 4
+
+ nice top -b -n 1 > top$i &
+
+ # Save about:tcmalloc
+ ctrl t && xte "str about:tcmalloc" && xte "key Return" && sleep 4
+ ctrl r && sleep 4 # reload because about:tcmalloc gives stale info otherwise!
+ ctrl s && sleep 2 && xte "str `pwd`/at$i" && xte "key Return" && sleep 3
+ ctrl w && sleep 4
+
+ # Save inbox
+ ctrl t && xte "str mail.google.com/mail/u/0/?ui=html&zy=a" && xte "key Return" && sleep 8
+ ctrl s && sleep 2 && xte "str `pwd`/inbox$i" && xte "key Return" && sleep 3
+ ctrl w && sleep 4
+
+ fi
+
+ xte "key Tab" && sleep 4
+ xte "str super duper subject $i" && sleep 4
+ xte "key Tab" && body && sleep 15 && xte "key Tab"
+ xte "key Return" && sleep 6
+ xte "str kk" && sleep 4 && xte "key Return" && sleep 4
+ xte "str kk" && sleep 4
+
+done
+
+ctrl shift q
« no previous file with comments | « third_party/tcmalloc/chromium/src/dmprof ('k') | third_party/tcmalloc/chromium/src/heap-profile-table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698