* gc.c (tick): Use __builtin_ppc_get_timebase for POWER arch.
  [Fix GH-1291]

This gives a little performance improvement

        user     system      total        real
Before: 20.870000   0.000000  20.870000 ( 20.893959)
After:  20.720000   0.000000  20.720000 ( 20.733970)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-03-17 08:14:53 +00:00
Родитель 6545327e24
Коммит a5456a1d83
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Mar 17 17:14:51 2016 Dinar Valeev <dvaleev@suse.com>
* gc.c (tick): Use __builtin_ppc_get_timebase for POWER arch.
[Fix GH-1291]
Thu Mar 17 11:51:48 2016 NARUSE, Yui <naruse@ruby-lang.org>
* lib/securerandom.rb (gen_random): to avoid blocking on Windows.

12
gc.c
Просмотреть файл

@ -935,6 +935,18 @@ tick(void)
return ((unsigned long long)lo)|( ((unsigned long long)hi)<<32);
}
#elif defined(__powerpc64__) && \
( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
typedef unsigned long long tick_t;
#define PRItick "llu"
static __inline__ tick_t
tick(void)
{
unsigned long long val = __builtin_ppc_get_timebase();
return val;
}
#elif defined(_WIN32) && defined(_MSC_VER)
#include <intrin.h>
typedef unsigned __int64 tick_t;