OSDN Git Service

Handle profiling buffer underrun.
authorAndy McFadden <fadden@android.com>
Fri, 5 Jun 2009 00:00:58 +0000 (17:00 -0700)
committerAndy McFadden <fadden@android.com>
Fri, 5 Jun 2009 18:30:29 +0000 (11:30 -0700)
commit183ce5809a5476fcfad36e0f7da951963f1390b8
tree5407d1a34105f16bd8a68263793ca799a9efce85
parentbd044e0df405c771e1d4c3f14f870ffa78a20c0f
Handle profiling buffer underrun.

In rare circumstances it's possible for the thread executing the "stop
profiling" method to start processing the data before all other threads
have finished writing data.  In particular, it's possible for a thread
to be switched out after advancing the offset pointer but before writing
actual data.

This is problematic because the buffer is expected to contain method
pointers.  The fill value (0xee) does not yield a valid pointer.

This adds a short usleep() to reduce the likelihood of the problem
occurring, and adds a buffer scan to detect partial records.  When
encountered, the rest of the log is truncated.

For internal bug 1861898.
vm/Profile.c