| 1 |
/* |
| 2 |
* Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. |
| 3 |
* Use of this source code is governed by a BSD-style license that can be |
| 4 |
* found in the LICENSE file. |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <Python.h> |
| 8 |
#include <mach/mach_time.h> |
| 9 |
|
| 10 |
#include "../../arch/all/init.h" |
| 11 |
#include "init.h" |
| 12 |
|
| 13 |
|
| 14 |
struct mach_timebase_info PSUTIL_MACH_TIMEBASE_INFO; |
| 15 |
|
| 16 |
// Called on module import. |
| 17 |
int |
| 18 |
psutil_setup_osx(void) { |
| 19 |
kern_return_t ret; |
| 20 |
|
| 21 |
ret = mach_timebase_info(&PSUTIL_MACH_TIMEBASE_INFO); |
| 22 |
if (ret != KERN_SUCCESS) { |
| 23 |
psutil_PyErr_SetFromOSErrnoWithSyscall("mach_timebase_info"); |
| 24 |
return 1; |
| 25 |
} |
| 26 |
return 0; |
| 27 |
} |