| 893 |
: r)); |
: r)); |
| 894 |
} |
} |
| 895 |
|
|
| 896 |
#elif defined(_POSIX_SOURCE) || defined(FREEBSD) |
#elif defined(_POSIX_SOURCE) || defined(__FreeBSD__) |
| 897 |
|
|
| 898 |
#include <pthread.h> |
#include <pthread.h> |
| 899 |
#include <unistd.h> |
#include <unistd.h> |
| 1069 |
(unsigned)mask, |
(unsigned)mask, |
| 1070 |
(unsigned)mask_s); |
(unsigned)mask_s); |
| 1071 |
#endif |
#endif |
| 1072 |
|
/* todo WIN32 でないときの n 倍表示 */ |
| 1073 |
if (popcnt64(mask_s) == 1) |
if (popcnt64(mask_s) == 1) |
| 1074 |
/* 何も言うまい */; |
/* 何も言うまい */; |
| 1075 |
else if (mask == mask_s) |
else if (mask == mask_s) |
| 1095 |
m |= 1ULL << i; |
m |= 1ULL << i; |
| 1096 |
|
|
| 1097 |
return m; |
return m; |
| 1098 |
|
|
| 1099 |
|
#elif defined( __FreeBSD__ ) |
| 1100 |
|
|
| 1101 |
|
#include <sys/sysctl.h> |
| 1102 |
|
|
| 1103 |
|
int i; |
| 1104 |
|
uint64_t m; |
| 1105 |
|
int nCPU; |
| 1106 |
|
int mib[2]; |
| 1107 |
|
size_t len; |
| 1108 |
|
|
| 1109 |
|
mib[0] = CTL_HW; |
| 1110 |
|
mib[1] = HW_NCPU; |
| 1111 |
|
len = sizeof( nCPU ); |
| 1112 |
|
sysctl( mib, 2, &nCPU, &len, NULL, 0 ); |
| 1113 |
|
m = (1ULL << nCPU) - 1; |
| 1114 |
|
|
| 1115 |
|
return m; |
| 1116 |
|
|
| 1117 |
|
#elif defined( __sun__ ) |
| 1118 |
|
|
| 1119 |
|
#include <sys/unistd.h> |
| 1120 |
|
#include <sys/processor.h> |
| 1121 |
|
|
| 1122 |
|
uint64_t m; |
| 1123 |
|
processorid_t i, cpuid_max; |
| 1124 |
|
|
| 1125 |
|
m = 0; |
| 1126 |
|
cpuid_max = sysconf( _SC_CPUID_MAX ); |
| 1127 |
|
for ( i = 0; i <= cpuid_max; i++ ) { |
| 1128 |
|
if ( p_online( i, P_STATUS ) == P_ONLINE ) { |
| 1129 |
|
m |= 1ULL << i; |
| 1130 |
|
} |
| 1131 |
|
} |
| 1132 |
|
|
| 1133 |
|
return m; |
| 1134 |
|
|
| 1135 |
#else |
#else |
| 1136 |
|
|
| 1137 |
/* XXX プロセッサ数を調べ上げてください */ |
/* XXX プロセッサ数を調べ上げてください */ |
| 1771 |
こーゆー系のアプリは低めに設定するのが吉(かも) */ |
こーゆー系のアプリは低めに設定するのが吉(かも) */ |
| 1772 |
#ifdef WIN32 |
#ifdef WIN32 |
| 1773 |
h = GetCurrentProcess(); |
h = GetCurrentProcess(); |
| 1774 |
|
/* todo 基本優先度の設定が二箇所にある */ |
| 1775 |
SetPriorityClass( h, BELOW_NORMAL_PRIORITY_CLASS ); |
SetPriorityClass( h, BELOW_NORMAL_PRIORITY_CLASS ); |
| 1776 |
#endif |
#endif |
| 1777 |
#if defined( thread_set_priority ) |
#if defined( thread_set_priority ) |
| 2078 |
#endif /* SELF */ |
#endif /* SELF */ |
| 2079 |
|
|
| 2080 |
sprintf( len, "%02d", hitLen ); |
sprintf( len, "%02d", hitLen ); |
| 2081 |
|
if ( hitLen < 10 ) { |
| 2082 |
|
/* たまたま後ろに区切り文字が付いた場合、一桁目を E にする */ |
| 2083 |
|
if ( hash[hitLen] == '.' || hash[hitLen] == '/' ) { |
| 2084 |
|
len[0] = 'E'; |
| 2085 |
|
} |
| 2086 |
|
} |
| 2087 |
|
|
| 2088 |
#if SEQ > 0 /* だがしかし、SEQ == 8 の場合しか考えてない */ |
#if SEQ > 0 /* だがしかし、SEQ == 8 の場合しか考えてない */ |
| 2089 |
/* 連モノの処理方法をちゃんと追いかけるべきだが、めんどくさいのでこれで */ |
/* 連モノの処理方法をちゃんと追いかけるべきだが、めんどくさいのでこれで */ |
| 2124 |
/* 速度計測 */ |
/* 速度計測 */ |
| 2125 |
status.loop += N_ALU * ALU_BITS; |
status.loop += N_ALU * ALU_BITS; |
| 2126 |
|
|
| 2127 |
|
/* -g オプション用のコードは、Win32 用しかない */ |
| 2128 |
|
/* todo UNIX 系用コードも要るかな */ |
| 2129 |
#if defined(WIN32) |
#if defined(WIN32) |
| 2130 |
if ( sCnt >= YOUSUMI ) { |
if ( sCnt >= YOUSUMI ) { |
| 2131 |
lCnt++; |
lCnt++; |