set the maximum number of replication correctly

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
use valloc for reading cow data object

Sheep may read the cow data object from local, so we need to use
valloc() here.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
trace: driver trace to work

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: low level functions in assembly

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: add low level ip2function support

We use GCC's stabs to map IP to its symbol(Function Name).
Normally, loader doesn't load symbol into memory, we have to
manually code ld script to load it.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
logger: teach logger funcs to notrace

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: export some structures for trace use

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: low-level trace infrastructure proper

We achieves this by dynamically patching the binary code at runtime,
making use of GCC -pg instrumentation features, which instrument a
5-bytes opcode in every function.

When the trace is
 turned off, the opcode is patched as NOP opcode.
 turned on, the opcode is a call opcode to our trace functions and
 we can hook callbacks both for function entry and exit.

This is how the 'graph' tracer atually calculate the time spent
by function.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: add graph tracer

- add return hooker

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: add a ring buffer

Tracers use this ring buffer to store its output internally.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: revert coroutine for fixing group_handler() race

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
sheep: fix group_handler face

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: add a new interface for trace utility

usage:
collie/collie debug trace start #start tracing sheep
collie/collie debug trace stop #stop tracing sheep

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
trace: support cat operation from collie

usage:
after tracing the sheep, you can get a function graph:
  collie debug trace cat

- use per thread buffer, so no lock overhead
- every buffer has the size of 8M
- after trace buffer is catted, the buffer is reset, that is,
  you can not cat it again to get the output.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>