2015-06-05 19:23:32 +08:00
|
|
|
// +build cgo,linux cgo,freebsd
|
2014-07-15 08:00:05 +08:00
|
|
|
|
|
|
|
package system
|
|
|
|
|
|
|
|
/*
|
|
|
|
#include <unistd.h>
|
2016-05-14 00:37:58 +08:00
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
int GetLongBit() {
|
|
|
|
#ifdef _SC_LONG_BIT
|
|
|
|
int longbits;
|
|
|
|
|
|
|
|
longbits = sysconf(_SC_LONG_BIT);
|
|
|
|
if (longbits < 0) {
|
|
|
|
longbits = (CHAR_BIT * sizeof(long));
|
|
|
|
}
|
|
|
|
return longbits;
|
|
|
|
#else
|
|
|
|
return (CHAR_BIT * sizeof(long));
|
|
|
|
#endif
|
|
|
|
}
|
2014-07-15 08:00:05 +08:00
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
func GetClockTicks() int {
|
2014-07-19 06:08:54 +08:00
|
|
|
return int(C.sysconf(C._SC_CLK_TCK))
|
2014-07-15 08:00:05 +08:00
|
|
|
}
|
2016-04-29 01:49:29 +08:00
|
|
|
|
|
|
|
func GetLongBit() int {
|
2016-05-14 00:37:58 +08:00
|
|
|
return int(C.GetLongBit())
|
2016-04-29 01:49:29 +08:00
|
|
|
}
|