EventLogpublic class EventLog extends Object {@hide}
Dynamically defined (in terms of event types), space efficient (i.e. "tight") event logging
to help instrument code for large scale stability and performance monitoring.
Note that this class contains all static methods. This is done for efficiency reasons.
Events for the event log are self-describing binary data structures. They start with a 20 byte
header (generated automatically) which contains all of the following in order:
- Payload length: 2 bytes - length of the non-header portion
- Padding: 2 bytes - no meaning at this time
- Timestamp:
- Seconds: 4 bytes - seconds since Epoch
- Nanoseconds: 4 bytes - plus extra nanoseconds
- Process ID: 4 bytes - matching {@link android.os.Process#myPid}
- Thread ID: 4 bytes - matching {@link android.os.Process#myTid}
The above is followed by a payload, comprised of the following:
- Tag: 4 bytes - unique integer used to identify a particular event. This number is also
used as a key to map to a string that can be displayed by log reading tools.
- Type: 1 byte - can be either {@link #INT}, {@link #LONG}, {@link #STRING},
or {@link #LIST}.
- Event log value: the size and format of which is one of:
- INT: 4 bytes
- LONG: 8 bytes
- STRING:
- Size of STRING: 4 bytes
- The string: n bytes as specified in the size fields above.
- {@link List LIST}:
- Num items: 1 byte
- N value payloads, where N is the number of items specified above.
- '\n': 1 byte - an automatically generated newline, used to help detect and recover from log
corruption and enable stansard unix tools like grep, tail and wc to operate
on event logs.
Note that all output is done in the endian-ness of the device (as determined
by {@link ByteOrder#nativeOrder()}). |
Fields Summary |
---|
public static final byte | INT | public static final byte | LONG | public static final byte | STRING | public static final byte | LIST |
Methods Summary |
---|
public static native void | readEvents(int[] tags, java.util.Collection output)Read events from the log, filtered by type.
| public static native int | writeEvent(int tag, int value)Send an event log message.
| public static native int | writeEvent(int tag, long value)Send an event log message.
| public static native int | writeEvent(int tag, java.lang.String str)Send an event log message.
| public static native int | writeEvent(int tag, android.util.EventLog$List list)Send an event log message.
| public static int | writeEvent(int tag, java.lang.Object list)Send an event log message.
return writeEvent(tag, new List(list));
|
|