001/* 002 * Copyright 2010-2015 Institut Pasteur. 003 * 004 * This file is part of Icy. 005 * 006 * Icy is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Icy is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Icy. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package icy.system; 020 021/** 022 * Uses system.profile.CPUMonitor instead 023 * 024 * @author Stephane 025 * @deprecated 026 */ 027@Deprecated 028public class CPUMonitor 029{ 030 private final icy.system.profile.CPUMonitor mon; 031 032 public CPUMonitor() 033 { 034 mon = new icy.system.profile.CPUMonitor(); 035 } 036 037 public CPUMonitor(int type) 038 { 039 mon = new icy.system.profile.CPUMonitor(type); 040 } 041 042 public void start() throws IllegalAccessError 043 { 044 mon.start(); 045 } 046 047 public void stop() 048 { 049 mon.stop(); 050 } 051 052 public long getCPUElapsedTimeMilli() 053 { 054 return mon.getCPUElapsedTimeMilli(); 055 } 056 057 public long getUserElapsedTimeMilli() 058 { 059 return mon.getUserElapsedTimeMilli(); 060 } 061 062 public double getCPUElapsedTimeSec() 063 { 064 return mon.getCPUElapsedTimeSec(); 065 } 066 067 public double getUserElapsedTimeSec() 068 { 069 return mon.getUserElapsedTimeSec(); 070 } 071 072 public double getElapsedTimeSec() 073 { 074 return mon.getElapsedTimeSec(); 075 } 076 077 public int getThreadCount() 078 { 079 return mon.getThreadCount(); 080 } 081 082 /** 083 * Uses SystemUtil.getAvailableProcessors() instead. 084 * 085 * @deprecated 086 */ 087 @Deprecated 088 public static int getAvailableProcessors() 089 { 090 return SystemUtil.getNumberOfCPUs(); 091 } 092 093 public long getElapsedTimeMilli() 094 { 095 return mon.getElapsedTimeMilli(); 096 } 097}