I'm looking into adding to frameworks/base/preloaded-classes. There
are a few basic classes that we've added that a lot of the
applications and services are using.
I was using `procrank` to attempt to measure the memory difference. I
expected that Uss should go down, as the amount of shared resources
goes up, but the opposite seems to happen. I'm not sure if the
differences I'm seeing are just noise in the system.
I then saw frameworks/base/tools/preload, which seems promising to
help determine if my changes should be added. I can't find any
documentation about it, but it seems like you're supposed to do
something like:
adb logcat > logcat.txt
(as root) java -cp preload.jar Compile logcat.txt logcat.compiled
then, either
(as root) java -cp preload.jar PrintCsv logcat.compiled
or
(as root) java -cp preload.jar PrintPsTree logcat.compiled
Then I'm guessing you can open the csv or ps to see statistics about
the preloaded classes (from skimming through the source). When I
attempt to run Compile, it fails, though:
# java -cp out/host/linux-x86/framework/preload.jar Compile logcat.txt
logcat.compiled
Got bad response for null: Dalvik VM init failed (check log file)
Got memory usage for null.
Writing object model...
Done!
# adb shell dalvikvm -Xbootclasspath:/system/framework/core.jar:/
system/framework/ext.jar:/system/framework/framework.jar:/system/
framework/framework-tests.jar:/system/framework/services.jar:/system/
framework/loadclass.jar
Dalvik VM init failed (check log file)
I don't have a /system/framework/loadclass.jar, nor are there any
references to it online. If I remove it, the same error occurs. I
don't know where the log file is at. The logs in /dev/log are some
binaries that I don't know the reader for.
So,
1) Does anyone know how I'm supposed to use preload?
2) Is there a different way I should be measuring the changes?
Thanks
PS It would also be helpful to have a README with this code.
In particular, preloaded classes cannot (directly or indirectly) cause
threads to be started, even transiently. The zygote process is limited
to being single-threaded. I don't think anything verifies
single-threadedness at runtime, but Strange Things may happen if the
zygote spawns a thread.
-dan
I think Dan meant "you can't use threads in zygote before it forks".
JBQ
On Thu, Sep 24, 2009 at 5:34 PM, GeunSik Lim (invain) <lee...@gmail.com> wrote:
>
>
>
> On Sep 24, 6:51 am, Dan Bornstein <danf...@android.com> wrote:
>> On Wed, Sep 23, 2009 at 2:25 PM, Dianne Hackborn <hack...@android.com> wrote:
>> In particular, preloaded classes cannot (directly or indirectly) cause
>> threads to be started, even transiently. The zygote process is limited
>> to being single-threaded. I don't think anything verifies
> I am confusing because of single-threaded expression a bit.
> As we all know, Zygote is just process that pre-forked for speed-up.
> Dan, Did you explain using single-thread word about Zygote
> because Zygote have 2827 task in "/process/2827/task/*" folder as
> single-threaded.?
> For example ( 2827 is Zygote Process),
> target#> ls /proc/2827/task/
> 2827
> target#> cat /proc/2827/status | grep Threads
> Threads: 1
>
>> single-threadedness at runtime, but Strange Things may happen if the zygote spawns a thread.
Jean-Baptiste M. "JBQ" Queru> Yes, I guess so.
> Preforked Zygote make application process
> when New tasks like Home,Contacts created by User.
> So, I think that the zygote have to fork a new process without a new
> thread.
>
> In a summary,
> When we run browseron android platform ,
> broswer applicaiton process is made by Zygote Process.
> And the, browser process consists of below threads.
>
> Thread-No Thread-Name
> -----------------------------------------
> 861 app_process (com.android.browser )
> 862 HeapWorker
> 863 Signal Catcher
> 864 JDWP (Java Debug Wire Protocol)
> 865 Binder Thread #
> 866 Binder Thread #
> 867 Binder Thread #
> 870 CookieSyncManager
> 872 AsyncTask #1 (computation that runs on a background thread)
> 873 WebViewCoreThread
> 876 WebViewCoreThread
> 877 WebViewCoreThread
> 879 http0
> 880 http1
> 881 http2
> 882 http3
>
>
>> -dan
>
> >
>
--
Software Engineer, Android Open-Source Project, Google.
Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.
Hello,