void chpl_vdebug_stop (void) { struct rusage ru; struct timeval tv; chpl_taskID_t stopTask = chpl_task_getId(); // First, shutdown VisualDebug chpl_vdebug = 0; uninstall_callbacks(); // Now log the stop if (chpl_vdebug_fd >= 0) { (void) gettimeofday (&tv, NULL); if ( getrusage (RUSAGE_SELF, &ru) < 0) { ru.ru_utime.tv_sec = 0; ru.ru_utime.tv_usec = 0; ru.ru_stime.tv_sec = 0; ru.ru_stime.tv_usec = 0; } // Generate the End record chpl_dprintf (chpl_vdebug_fd, "End: %lld.%06ld %ld.%06ld %ld.%06ld %d %d\n", (long long) tv.tv_sec, (long) tv.tv_usec, (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec, chpl_nodeID, (int) stopTask); close (chpl_vdebug_fd); } }
void chpl_vdebug_stop (void) { struct rusage ru; struct timeval tv; struct timezone tz = {0,0}; if (chpl_vdebug_fd >= 0) { (void) gettimeofday (&tv, &tz); if ( getrusage (RUSAGE_SELF, &ru) < 0) { ru.ru_utime.tv_sec = 0; ru.ru_utime.tv_usec = 0; ru.ru_stime.tv_sec = 0; ru.ru_stime.tv_usec = 0; } // Generate the End record chpl_dprintf (chpl_vdebug_fd, "End: %lld.%06ld %ld.%06ld %ld.%06ld %d\n", (long long) tv.tv_sec, (long) tv.tv_usec, (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec, chpl_nodeID); close (chpl_vdebug_fd); } chpl_vdebug = 0; uninstall_callbacks(); }
int install_callbacks (void) { if (chpl_task_install_callback(chpl_task_cb_event_kind_create, chpl_task_cb_info_kind_full, cb_task_create) != 0) return 1; if (chpl_task_install_callback(chpl_task_cb_event_kind_begin, chpl_task_cb_info_kind_full, cb_task_begin) != 0) { (void) uninstall_callbacks(); return 1; } if (chpl_task_install_callback(chpl_task_cb_event_kind_end, chpl_task_cb_info_kind_id_only, cb_task_end) != 0) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_put_nb, cb_comm_put_nb)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_get_nb, cb_comm_get_nb)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_put, cb_comm_put)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_get, cb_comm_get)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_put_strd, cb_comm_put_strd)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_get_strd, cb_comm_get_strd)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_executeOn, cb_comm_executeOn)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_executeOn_nb, cb_comm_executeOn_nb)) { (void) uninstall_callbacks(); return 1; } if (chpl_comm_install_callback(chpl_comm_cb_event_kind_executeOn_fast, cb_comm_executeOn_fast)) { (void) uninstall_callbacks(); return 1; } return 0; }