History log of /bionic/benchmarks/unistd_benchmark.cpp
Revision Date Author Comments
7086ad6919feb2415c6027163f5c63323bcca27c 20-Jun-2014 Elliott Hughes <enh@google.com> Cache getpid.

In practice, with this implementation we never need to make a system call.
We get the main thread's tid (which is the same as our pid) back from
the set_tid_address system call we have to make during initialization.
A new pthread will have the same pid as its parent, and a fork child's
main (and only) thread will have a pid equal to its tid, which we get for
free from the kernel before clone returns.

The only time we'd actually have to make a getpid system call now is if
we take a signal during fork and the signal handler calls getpid. (That,
or we call getpid in the dynamic linker while it's still dealing with its
own relocations and hasn't even set up the main thread yet.)

Bug: 15387103
Change-Id: I6d4718ed0a5c912fc75b5f738c49a023dbed5189
b27a840f4b520bfa095db99b0a2e5205634b0003 11-Jun-2014 Elliott Hughes <enh@google.com> Add __pure2 to a few more functions, most notably gettid and pthread_self.

Change-Id: I7eee9f26f45130038af09d8285782b07f70a996f
7634db5a0657129225869c3650a992f9cbe82fe4 10-Jun-2014 Elliott Hughes <enh@google.com> Add a couple more system call benchmarks.

Bug: 15387103
Change-Id: I13419ddf77d201fdbde4c784259c0cb0dcfb9a77
5d9a7ba0dc9c24ed4e4efa9cac0e796fd524b308 31-May-2014 Elliott Hughes <enh@google.com> Avoid a system call in 'gettid'.

System calls can be pretty slow. This is mako, which has one of our
lowest latencies:

iterations ns/op
BM_unistd_getpid 10000000 209
BM_unistd_gettid 200000000 8

Bug: 15297299 (kernel panic from too many gettid calls)
Bug: 15315766 (excessive gettid overhead in liblogd)
Change-Id: I49656c0fc5b5d092390264a59e4f2c0d8a8b1aeb
b28e490b7350b21c5ae9e5b3bb3e082d8357a1b0 11-Mar-2014 Elliott Hughes <enh@google.com> Add various benchmarks.

These are based on ones from system/extras/tests/bionic/.

Change-Id: I7b1ae15a2ca5d1031a6a511d97b88125c1770047