define macro TS_HRTIME_XXX directly

   old macro defines can NOT be used in plugin because the target macros
   defined in lib/ts/ink_hrtime.h
TS-977 RecCore: refine P_RecCore.i and rename it to P_RecCore.cc

The suffix of P_RecCore.i is weird for us:
1) cscope can't find the function definition in it by default.
2) using *.i suffix usually indicates that there are something
   bad in design. We can share the code gracefully if spliting the
   function/class carefully.

Let's refine the code so that we can rename it to P_RecCore.cc safely.
BTW, remove an useless file: ./iocore/utils/diags.i.

I have noticed that there are several test_*.i files which is not so
important for us, just keep it as it is.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-977: Fix RecMessageSend regression

After removing the static g_mode_type variable from RecMessage.cc file
by previous commit: 3321de50, traffic_manager will crash when boot.

The root cause is that RecMessageSend() will be called before lmgmt has
been initialized.

We can simply check g_message_initialized instead of g_mode_type to
decide whether RecMessageSend() could be executed safely.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-1252: stats summary in cluster not working

Here is some stats with evil result, we all know that most stats
with proxy.process.cluster prefix have no result at all.

   proxy.process.cluster.open_delays=-4411607530454032024
   proxy.process.cluster.control_messages_avg_send_time=-72.902885
   proxy.process.cluster.open_delay_time=-2494.564697
   proxy.process.cluster.rmt_cache_callback_time=-747.036865
   proxy.process.cluster.local_connection_time=-15.002351

When int64_t integer was passed to CLUSTER_SUM_DYN_STAT(x, y) as
2th parameter, it would be convert to int unsafely.
TS-1678: Simplify register_record()

'release_record_lock' parameter to register_record() is unnecessarily
complicated and the lock release is dangerous. Let's simplify it
and remove verbose lock releasing from the upper layer code.
TS-1739: Fix TODO within varFloatFromName()

Return value from RecGetRecordDataType() should be checked, and
fix harmless but weird conversion type.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-1738 stats: missing "proxy.cluster.cache_total_hits_mem" in RecordsConfig

1. we had defined "proxy.node.cache_total_hits_mem", a corresponding clsuter
   record should be defined.

2. "proxy.cluster.cache_total_hits_mem" are using in stats.config.xml file,
   missing definition will cause unexpected result.

BTW: fix weird tailling spaces by my VIM automatically.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-1740: Improve precision of stats values

Conversion between types, such as RecInt(int64_t) to RecFloat(float),
may lead to loss of precision.

In the old code, token value was defined with StatFloat type, it would casue
unnecessary conversion when type of token is not StatFloat.

it's best to keep value with the same type of token as much as possiable.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-1671: remove AlarmListable from overviewRecord
TS-1758 Remove unused overviewPage aggregation functions.
TS-1754 Warnings from stats evaluation.
TS-1736: Fatal() terminates process without a backtrace

The root casue is that cleanup_func() was called before logging
backtrace in Diags::error(), however cleanup_func() would terminate
process by calling exit() directly.
TS-1805: fix conversion when pass value to statVarSet()

The result from NodeStatEval()/ClusterStatEval() could have different type
compare to the token type of m_node_dest/m_cluster_dest.

So we should do conversion in statVarSet() when they are different.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-1805: fix uninitialized result_type in NodeStatEval()

BTW, refine the output when call Fatal() in statVarSet().

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Zhao Yongming <ming.zym@gmail.com>
TS-2173: RECD_COUNTER type is missing in setTokenValue()

After applied "TS-1740: Improve precision of stats values" patch,
each token will keep its original type instead of forcing to RecFloat.

So we should update setTokenValue() to deal with RECD_COUNTER case.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>