/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This source file is part of SableVM. * * * * See the file "LICENSE" for the copyright information and for * * the terms and conditions for copying, distribution and * * modification of this source file. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define SA_SIGONFAULT 0x00000008u static volatile u_int64_t page_faults = 0; svm_static void pagefault_handler(int signo, siginfo_t *info, void *dummy) { page_faults++; } svm_static jint _svmf_stats_init (void) { struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sa.sa_sigaction = pagefault_handler; sa.sa_flags = SA_SIGINFO | SA_SIGONFAULT; if (sigaction(SIGRTMIN+10, &sa, 0) != 0) return JNI_ERR; return JNI_OK; } svm_static u_int64_t _svmf_stats_get_pagefaults (void) { return page_faults; }