Fix remaining small issues with the lock sampling.

* Eliminate the now unused lockprofsample flag.  The sample percentage
  has been a function of the wait time an threshold since the previous
  change.

* Eliminate some trailing whitespace that creeped into the previous
  change.

* Eliminate the trailing newline from the event buffer.  Because the
  buffer pointer was not incremented this character was not seen in
  the event log anyway.

* Document the lockProfThreshold global.

Change-Id: Ia1c1fcf862d76f5631601e05e7941e5171fab097
diff --git a/vm/Globals.h b/vm/Globals.h
index 6d6f3b6..e27d5d8 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -90,8 +90,13 @@
     int         jdwpPort;
     bool        jdwpSuspend;
 
+    /*
+     * Lock profiling threshold value in milliseconds.  Acquires that
+     * exceed threshold are logged.  Acquires within the threshold are
+     * logged with a probability of $\frac{time}{threshold}$ .  If the
+     * threshold is unset no additional logging occurs.
+     */
     u4          lockProfThreshold;
-    u4          lockProfSample;
 
     int         (*vfprintfHook)(FILE*, const char*, va_list);
     void        (*exitHook)(int);
diff --git a/vm/Init.c b/vm/Init.c
index f091113..6630395 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -902,8 +902,6 @@
 
         } else if (strncmp(argv[i], "-Xlockprofthreshold:", 20) == 0) {
             gDvm.lockProfThreshold = atoi(argv[i] + 20);
-        } else if (strncmp(argv[i], "-Xlockprofsample:", 17) == 0) {
-            gDvm.lockProfSample = atoi(argv[i] + 17);
 
 #ifdef WITH_JIT
         } else if (strncmp(argv[i], "-Xjitop", 7) == 0) {
diff --git a/vm/Sync.c b/vm/Sync.c
index 7afe514..1405315 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -418,9 +418,6 @@
     /* Emit the sample percentage, 5 bytes. */
     cp = logWriteInt(cp, samplePercent);
 
-    /* Emit a trailing newline, apparently the EVENT_TYPE_LIST convention. */
-    *cp = '\n';
-
     assert((size_t)(cp - eventBuffer) <= sizeof(eventBuffer));
     android_btWriteLog(EVENT_LOG_TAG_dvm_lock_sample,
                        EVENT_TYPE_LIST,
@@ -460,7 +457,7 @@
             } else {
                 samplePercent = 100 * waitMs / waitThreshold;
             }
-            if (samplePercent != 0 && ((u4)rand() % 100 < samplePercent)) { 
+            if (samplePercent != 0 && ((u4)rand() % 100 < samplePercent)) {
                 logContentionEvent(self, waitMs, samplePercent);
             }
         }
@@ -525,7 +522,7 @@
          */
         dvmThrowExceptionFmt("Ljava/lang/IllegalMonitorStateException;",
                              "unlock of unowned monitor, self=%d owner=%d",
-                             self->threadId, 
+                             self->threadId,
                              mon->owner ? mon->owner->threadId : 0);
         return false;
     }