-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ALog Prologue now keeps only last part of source path (filename), using us timestamps #364
Conversation
Signed-off-by: Coldwings <coldwings@me.com>
Signed-off-by: Coldwings <coldwings@me.com>
auto ts = update_now(); | ||
*sec = ts / 1000000; | ||
*usec = ts % 1000000; | ||
} | ||
int timestamp_updater_init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move to alog.cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update_now()
_rdtsc()
last_tsc
are defined as inline or static unit in thread.cpp, alog_update_now()
needs to call those functions and set last_tsc
now
so time update can also used by thread scheduler.
common/alog.h
Outdated
@@ -525,6 +539,12 @@ inline NamedValue<T> make_named_value(const char (&name)[N], T&& value) | |||
|
|||
#define VALUE(x) make_named_value(#x, x) | |||
|
|||
template <size_t N> | |||
inline LogBuffer& operator<<(LogBuffer& log, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better specialize make_named_value()
thread/thread.cpp
Outdated
@@ -1090,6 +1090,12 @@ R"( | |||
} | |||
return photon::now; | |||
} | |||
void alog_update_now(uint64_t *sec, uint64_t *usec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better return sec and usec directly as an std::pair, so that they are returned in registers.
#include <stdio.h>
#include <inttypes.h>
#include <utility>
std::pair<uint64_t, uint64_t> foo();
int main(int argc, char** argv) {
auto x = foo();
return (x.first + x.second) >> 3;
}
sec/usec are returned in rax/rdx as a result:
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000000001050 <+0>: sub $0x8,%rsp
0x0000000000001054 <+4>: callq 0x1030 <_Z3foov@plt>
0x0000000000001059 <+9>: add $0x8,%rsp
0x000000000000105d <+13>: add %rdx,%rax
0x0000000000001060 <+16>: shr $0x3,%rax
0x0000000000001064 <+20>: retq
End of assembler dump.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: return struct timeval
as result
Signed-off-by: Coldwings <coldwings@me.com>
Signed-off-by: Coldwings <coldwings@me.com>
5ca0b29
to
322c6d5
Compare
Signed-off-by: Coldwings <coldwings@me.com>
Signed-off-by: Coldwings <coldwings@me.com>
Signed-off-by: Coldwings <coldwings@me.com>
…ng us timestamps (alibaba#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com>
…ng us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com>
* fix compile (#353) * FIX httpfs_v2 common header for file able to replace by ioctl (#351) FIX httpfs common header for file able to replace by ioctl * ALog Prologue now keeps only last part of source path (filename), using us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> * Fix prologue file field length (#369) Signed-off-by: Coldwings <coldwings@me.com> * fix readdir for localfs Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> * fix --------- Signed-off-by: Coldwings <coldwings@me.com> Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com>
…ng us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com>
* Fix HTTPFSv2 using proxy (#336) Signed-off-by: Coldwings <coldwings@me.com> * FIX httpfs_v2 common header for file able to replace by ioctl (#351) FIX httpfs common header for file able to replace by ioctl * ALog Prologue now keeps only last part of source path (filename), using us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> * fix readdir for localfs Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> * Fix prologue file field length (#369) Signed-off-by: Coldwings <coldwings@me.com> * Fix: make_named_tuple maked ref to temporary alogstring (#375) Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com>
* fix compile (#353) * FIX httpfs_v2 common header for file able to replace by ioctl (#351) FIX httpfs common header for file able to replace by ioctl * ALog Prologue now keeps only last part of source path (filename), using us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> * Fix prologue file field length (#369) Signed-off-by: Coldwings <coldwings@me.com> * fix readdir for localfs Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> * fix * timer.h remove include alog.h (#371) * Auto PR from release/0.6 to release/0.7 (#376) * Fix HTTPFSv2 using proxy (#336) Signed-off-by: Coldwings <coldwings@me.com> * FIX httpfs_v2 common header for file able to replace by ioctl (#351) FIX httpfs common header for file able to replace by ioctl * ALog Prologue now keeps only last part of source path (filename), using us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> * fix readdir for localfs Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> * Fix prologue file field length (#369) Signed-off-by: Coldwings <coldwings@me.com> * Fix: make_named_tuple maked ref to temporary alogstring (#375) Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> --------- Signed-off-by: Coldwings <coldwings@me.com> Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Huiba Li <huiba.lhb@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Bob Chen <beef9999@qq.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Fix HTTPFSv2 using proxy (#336) Signed-off-by: Coldwings <coldwings@me.com> * FIX httpfs_v2 common header for file able to replace by ioctl (#351) FIX httpfs common header for file able to replace by ioctl * ALog Prologue now keeps only last part of source path (filename), using us timestamps (#364) * Fix alog namedvalue print character array Signed-off-by: Coldwings <coldwings@me.com> * ALog prologue keeps only filename, uses us timestamp Signed-off-by: Coldwings <coldwings@me.com> * make `update_now` returns timeval, so as `alog_update_now()` Signed-off-by: Coldwings <coldwings@me.com> * Fix `make_named_value` Signed-off-by: Coldwings <coldwings@me.com> * `Prologue use const char* for string instead of uint64_t Signed-off-by: Coldwings <coldwings@me.com> * `prologue` with constexpr constructor Signed-off-by: Coldwings <coldwings@me.com> * prevent warning for make_named_value in clang Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> * fix readdir for localfs Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> * Fix prologue file field length (#369) Signed-off-by: Coldwings <coldwings@me.com> * Fix: make_named_tuple maked ref to temporary alogstring (#375) Signed-off-by: Coldwings <coldwings@me.com> * Fix compile in gcc492 (#384) * Fix compile in gcc492, ignore some designed warning with diagnostic pragma Signed-off-by: Coldwings <coldwings@me.com> * Only add no-packed-bitfield-compat for GCC Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> --------- Signed-off-by: Coldwings <coldwings@me.com> Signed-off-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com> Co-authored-by: Coldwings <coldwings@me.com> Co-authored-by: Lanzheng Liu <lanzheng.liulz@alibaba-inc.com>
This pull request introduces a change to the ALog Prologue module. The modification made is to keep only the last part of the source path, specifically the filename, while utilizing microsecond timestamps.
Microsecond timestamps shares photon thread timestamp
photon::now
.