Skip to content

Commit

Permalink
#0 Updated copyright dates; [Gui] thread_pool.cpp MSVC build fix; [Co…
Browse files Browse the repository at this point in the history
…re] Renamed getCurrentTime() to profiler::clock::now() + renamed profiler::currentTime() to profiler::now()
  • Loading branch information
cas4ey committed Jan 29, 2018
1 parent 1a333e4 commit 091d544
Show file tree
Hide file tree
Showing 73 changed files with 350 additions and 148 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017 Sergey Yagovtsev, Victor Zarubkin
Copyright (c) 2016-2018 Sergey Yagovtsev, Victor Zarubkin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions easy_profiler_core/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* description : The file contains implementation of profiling blocks
* :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -118,7 +118,7 @@ Block::Block(const BaseBlockDescriptor* _descriptor, const char* _runtimeName, b

void Block::start()
{
m_begin = getCurrentTime();
m_begin = profiler::clock::now();
}

void Block::start(timestamp_t _time) EASY_NOEXCEPT
Expand All @@ -128,7 +128,7 @@ void Block::start(timestamp_t _time) EASY_NOEXCEPT

void Block::finish()
{
m_end = getCurrentTime();
m_end = profiler::clock::now();
}

void Block::finish(timestamp_t _time) EASY_NOEXCEPT
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/chunk_allocator.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/current_thread.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
11 changes: 7 additions & 4 deletions easy_profiler_core/current_time.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -72,7 +72,9 @@ The Apache License, Version 2.0 (the "License");
# endif//__ARM_ARCH
#endif

static inline profiler::timestamp_t getCurrentTime()
namespace profiler { namespace clock {

static inline profiler::timestamp_t now()
{
#if EASY_CHRONO_HIGHRES_CLOCK || EASY_CHRONO_STEADY_CLOCK
return (profiler::timestamp_t)EASY_CHRONO_CLOCK::now().time_since_epoch().count();
Expand Down Expand Up @@ -156,19 +158,20 @@ static inline profiler::timestamp_t getCurrentTime()
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
#else
#warning You need to define fast getCurrentTime() for your OS and CPU
#warning You need to define fast now() for your OS and CPU
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
#define EASY_CHRONO_CLOCK std::chrono::high_resolution_clock
#endif

#else // not _WIN32, __GNUC__, __ICC
#warning You need to define fast getCurrentTime() for your OS and CPU
#warning You need to define fast now() for your OS and CPU
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
#define EASY_CHRONO_CLOCK std::chrono::high_resolution_clock
#endif

#endif
}

} } // end of namespace profiler::clock.

#endif // EASY_PROFILER_CURRENT_TIME_H
2 changes: 1 addition & 1 deletion easy_profiler_core/easy_socket.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
4 changes: 2 additions & 2 deletions easy_profiler_core/event_trace_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* : * 2016/09/17 Victor Zarubkin: added log messages printing.
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -560,7 +560,7 @@ namespace profiler {

EASY_LOGMSG("Event tracing is stopping...\n");

TRACING_END_TIME.store(getCurrentTime(), ::std::memory_order_release);
TRACING_END_TIME.store(profiler::clock::now(), ::std::memory_order_release);

ControlTrace(m_openedHandle, KERNEL_LOGGER_NAME, props(), EVENT_TRACE_CONTROL_STOP);
CloseTrace(m_openedHandle);
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/event_trace_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* : *
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/hashed_cstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* : *
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/arbitrary_value.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* description : This file contains auxiliary profiler macros for different compiler support.
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/details/profiler_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* : *
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/details/profiler_colors.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/easy_net.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/easy_socket.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
50 changes: 28 additions & 22 deletions easy_profiler_core/include/easy/profiler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down Expand Up @@ -469,7 +469,7 @@ namespace profiler {
\ingroup profiler
*/
PROFILER_API timestamp_t currentTime();
PROFILER_API timestamp_t now();

/** Convert ticks to nanoseconds.
Expand Down Expand Up @@ -771,14 +771,14 @@ namespace profiler {

}
#else
inline timestamp_t currentTime() { return 0; }
inline timestamp_t toNanoseconds(timestamp_t) { return 0; }
inline timestamp_t toMicroseconds(timestamp_t) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t now() { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t toNanoseconds(timestamp_t) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t toMicroseconds(timestamp_t) { return 0; }
inline const BaseBlockDescriptor* registerDescription(EasyBlockStatus, const char*, const char*, const char*, int, block_type_t, color_t, bool = false)
{ return reinterpret_cast<const BaseBlockDescriptor*>(0xbad); }
inline void endBlock() { }
inline void setEnabled(bool) { }
inline bool isEnabled() { return false; }
inline EASY_CONSTEXPR_FCN bool isEnabled() { return false; }
inline void storeEvent(const BaseBlockDescriptor*, const char* = "") { }
inline void storeBlock(const BaseBlockDescriptor*, const char*, timestamp_t, timestamp_t) { }
inline void beginBlock(Block&) { }
Expand All @@ -787,26 +787,26 @@ namespace profiler {
inline const char* registerThreadScoped(const char*, ThreadGuard&) { return ""; }
inline const char* registerThread(const char*) { return ""; }
inline void setEventTracingEnabled(bool) { }
inline bool isEventTracingEnabled() { return false; }
inline EASY_CONSTEXPR_FCN bool isEventTracingEnabled() { return false; }
inline void setLowPriorityEventTracing(bool) { }
inline bool isLowPriorityEventTracing() { return false; }
inline EASY_CONSTEXPR_FCN bool isLowPriorityEventTracing() { return false; }
inline void setContextSwitchLogFilename(const char*) { }
inline const char* getContextSwitchLogFilename() { return ""; }
inline EASY_CONSTEXPR_FCN const char* getContextSwitchLogFilename() { return ""; }
inline void startListen(uint16_t = ::profiler::DEFAULT_PORT) { }
inline void stopListen() { }
inline bool isListening() { return false; }
inline uint8_t versionMajor() { return 0; }
inline uint8_t versionMinor() { return 0; }
inline uint16_t versionPatch() { return 0; }
inline uint32_t version() { return 0; }
inline const char* versionName() { return "v0.0.0_disabled"; }
inline bool isMainThread() { return false; }
inline timestamp_t this_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
inline timestamp_t this_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
inline timestamp_t this_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
inline timestamp_t main_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
inline timestamp_t main_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
inline timestamp_t main_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN bool isListening() { return false; }
inline EASY_CONSTEXPR_FCN uint8_t versionMajor() { return 0; }
inline EASY_CONSTEXPR_FCN uint8_t versionMinor() { return 0; }
inline EASY_CONSTEXPR_FCN uint16_t versionPatch() { return 0; }
inline EASY_CONSTEXPR_FCN uint32_t version() { return 0; }
inline EASY_CONSTEXPR_FCN const char* versionName() { return "v0.0.0_disabled"; }
inline EASY_CONSTEXPR_FCN bool isMainThread() { return false; }
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t this_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTime(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTimeLocalMax(Duration = ::profiler::MICROSECONDS) { return 0; }
inline EASY_CONSTEXPR_FCN timestamp_t main_thread_frameTimeLocalAvg(Duration = ::profiler::MICROSECONDS) { return 0; }
#endif

/** API functions binded to current thread.
Expand Down Expand Up @@ -899,6 +899,12 @@ namespace profiler {
*/
EASY_FORCE_INLINE void stopCapture() { EASY_PROFILER_DISABLE; }

/** Alias for now().
\ingroup profiler
*/
EASY_FORCE_INLINE timestamp_t currentTime() { return now(); }

//////////////////////////////////////////////////////////////////////

} // END of namespace profiler.
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/reader.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/include/easy/serialized_block.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/nonscoped_block.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/nonscoped_block.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
Lightweight profiler library for c++
Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
Licensed under either of
* MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion easy_profiler_core/outstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* : *
* ----------------- :
* license : Lightweight profiler library for c++
* : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
* : Copyright(C) 2016-2018 Sergey Yagovtsev, Victor Zarubkin
* :
* : Licensed under either of
* : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
Expand Down
Loading

0 comments on commit 091d544

Please sign in to comment.