Merge Bench4Q-Monitor

This commit is contained in:
coderfengyun 2014-03-20 11:27:12 +08:00
parent 07faeeb7c4
commit 02bd1f5b89
161 changed files with 5377 additions and 5101 deletions

View File

@ -0,0 +1,246 @@
package org.bench4q.master.report;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bench4q.master.domain.entity.MonitorResult;
import org.bench4q.master.domain.service.MonitorResultService;
import org.bench4q.master.domain.service.TestPlanScriptService;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.master.exception.Bench4QException;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.MonitorResultContainerModel;
import org.bench4q.share.models.monitor.MemoryModel;
import org.bench4q.share.models.monitor.NetworkInterfaceModel;
import org.bench4q.share.models.monitor.PhysicalDiskModel;
import org.bench4q.share.models.monitor.ProcessorModel;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lowagie.text.Document;
@Component
public class MonitorReportService {
public static String Processor = "ProcessorTimePercent (unit: %)";
public static String Memory = "Memory Available Memory(unit: KiloByte)";
public static String logical_Disk = "logicalDisk IO (unit: Byte)";
public static String network_Interface = "networkInterface IO (unit: Byte/second)";
private TestPlanScriptService testPlanScriptService;
private TestPlanService testPlanService;
private MonitorResultService monitorResultService;
public TestPlanScriptService getTestPlanScriptService() {
return testPlanScriptService;
}
@Autowired
public void setTestPlanScriptService(
TestPlanScriptService testPlanScriptService) {
this.testPlanScriptService = testPlanScriptService;
}
public TestPlanService getTestPlanService() {
return testPlanService;
}
@Autowired
public void setTestPlanService(TestPlanService testPlanService) {
this.testPlanService = testPlanService;
}
public MonitorResultService getMonitorResultService() {
return monitorResultService;
}
@Autowired
public void setMonitorResultService(
MonitorResultService monitorResultService) {
this.monitorResultService = monitorResultService;
}
void createMonitorResultImages(UUID testPlanRunID, Document document) throws Bench4QException {
Map<String, MonitorResultContainerModel> SUTResultMap = new HashMap<String, MonitorResultContainerModel>();
List<MonitorResult> results = this.getMonitorResultService()
.queryMonitorResults(testPlanRunID);
if (results == null) {
return;
}
for (MonitorResult result : results) {
if (result == null) {
continue;
}
buildSUTResultMap(SUTResultMap, result);
}
for (String hostName : SUTResultMap.keySet()) {
createSUTImage(hostName, SUTResultMap.get(hostName), document);
}
}
private void buildSUTResultMap(
Map<String, MonitorResultContainerModel> sUTResultMap,
MonitorResult result) {
String hostName = result.getHostNameUnderMonitor();
if (!sUTResultMap.containsKey(hostName)) {
sUTResultMap.put(result.getHostNameUnderMonitor(),
new MonitorResultContainerModel());
}
sortResultToList(result, sUTResultMap.get(hostName));
}
private void sortResultToList(final MonitorResult result,
MonitorResultContainerModel container) {
try {
if (Class.forName(result.getType()).equals(PhysicalDiskModel.class)) {
container.getLogicalDiskModels().add(
(PhysicalDiskModel) MarshalHelper.unmarshal(
PhysicalDiskModel.class, result.getContent()));
} else if (Class.forName(result.getType())
.equals(MemoryModel.class)) {
container.getMemoryModels().add(
(MemoryModel) MarshalHelper.unmarshal(
MemoryModel.class, result.getContent()));
} else if (Class.forName(result.getType()).equals(
NetworkInterfaceModel.class)) {
container.getNetWorkModels().add(
(NetworkInterfaceModel) MarshalHelper.unmarshal(
NetworkInterfaceModel.class,
result.getContent()));
} else if (Class.forName(result.getType()).equals(
ProcessorModel.class)) {
container.getProcessorModels().add(
(ProcessorModel) MarshalHelper.unmarshal(
ProcessorModel.class, result.getContent()));
}
} catch (Exception e) {
e.printStackTrace();
return;
}
}
private void createSUTImage(String hostName,
MonitorResultContainerModel container, Document document) {
try {
ReportService.addParagraph(logical_Disk, document);
createLogicalDiskImage(container.getLogicalDiskModels(), document);
ReportService.addParagraph(Memory, document);
createMemoryImage(container.getMemoryModels(), document);
ReportService.addParagraph(network_Interface, document);
// createNetworkImage(container.getNetWorkModels(), document);
ReportService.addParagraph(Processor, document);
createProcessorImage(container.getProcessorModels(), document);
} catch (Exception e) {
e.printStackTrace();
}
}
private void createProcessorImage(List<ProcessorModel> list,
Document document) throws Exception {
if (list == null || list.size() == 0) {
return;
}
int seriesCount = list.get(0).getProcessorModelList().size();
List<TimeSeries> timeSeriesArray = ReportService.buildSeries(
seriesCount, Processor);
for (ProcessorModel model : list) {
if (model == null)
continue;
for (int i = 0; i < timeSeriesArray.size(); i++) {
timeSeriesArray.get(i).addOrUpdate(
new Second(model.getSamplingTime()),
model.getProcessorModelList().get(i)
.getProcessorTimePercent());
}
}
ReportService.writeImageIntoPdf(
ReportService.buildChartStream(document, seriesCount,
timeSeriesArray, Processor).toByteArray(), document);
}
private void createMemoryImage(List<MemoryModel> list, Document document)
throws Exception {
if (list == null || list.size() == 0) {
return;
}
int seriesCount = 1;
List<TimeSeries> timeSeriesArray = ReportService.buildSeries(
seriesCount, Memory);
for (MemoryModel model : list) {
if (model == null)
continue;
for (int i = 0; i < timeSeriesArray.size(); i++) {
timeSeriesArray.get(i).addOrUpdate(
new Second(model.getSamplingTime()),
model.getAvailableKiloBytes());
}
}
ReportService.writeImageIntoPdf(
ReportService.buildChartStream(document, seriesCount,
timeSeriesArray, Memory).toByteArray(), document);
}
private void createLogicalDiskImage(List<PhysicalDiskModel> list,
Document document) throws Exception {
if (list == null || list.size() == 0) {
return;
}
int seriesCount = list.get(0).getFieFileSystemModels().size();
List<TimeSeries> timeSeriesArray = ReportService.buildSeries(
seriesCount, logical_Disk);
for (PhysicalDiskModel model : list) {
if (model == null)
continue;
for (int i = 0; i < timeSeriesArray.size(); i++) {
timeSeriesArray.get(i).addOrUpdate(
new Second(model.getSamplingTime()),
model.getFieFileSystemModels().get(i)
.getDiskTotalKBytesRate());
}
}
ReportService.writeImageIntoPdf(
ReportService.buildChartStream(document, seriesCount,
timeSeriesArray, logical_Disk).toByteArray(), document);
}
/**
* refactor this kind of use
*
* @param list
* @param document
* @throws Exception
*/
// private void createNetworkImage(List<NetworkInterfaceModel> list,
// Document document) throws Exception {
// if (list == null || list.size() == 0) {
// return;
// }
// int seriesCount = list.get(0).getNetworkList().size();
// List<TimeSeries> timeSeriesArray = ReportService.buildSeries(
// seriesCount, network_Interface);
// for (NetworkInterfaceModel model : list) {
// for (int i = 0; i < timeSeriesArray.size(); i++) {
// timeSeriesArray.get(i).addOrUpdate(
// new Second(model.getSamplingTime()),
// model.getNetworkList().get(i).getBytesTotalPerSecond());
// }
// }
// ReportService.writeImageIntoPdf(
// ReportService.buildChartStream(document, seriesCount,
// timeSeriesArray, network_Interface).toByteArray(),
// document);
// }
//}
}

View File

@ -0,0 +1,175 @@
package org.bench4q.master.report;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.bench4q.master.exception.ExceptionLog;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
@Component
public class ReportService {
public static String Time = "time";
public static String PDF_FOLDER = "report";
private ScriptReportService scriptReportService;
private MonitorReportService monitorReportService;
private Logger logger = Logger.getLogger(ReportService.class);
private static int PICTURE_WIDTH = 500;
private static int PICTURE_HIGHT = 450;
public ScriptReportService getScriptReportService() {
return scriptReportService;
}
@Autowired
public void setScriptReportService(ScriptReportService scriptReportService) {
this.scriptReportService = scriptReportService;
}
public MonitorReportService getMonitorReportService() {
return monitorReportService;
}
@Autowired
public void setMonitorReportService(
MonitorReportService monitorReportService) {
this.monitorReportService = monitorReportService;
}
public byte[] createReport(UUID testPlanRunID) {
try {
if (isReportCreated(testPlanRunID)) {
return FileUtils.readFileToByteArray(new File(ReportService
.buildFilePath(testPlanRunID)));
}
isFolderExist();
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(
buildFilePath(testPlanRunID)));
document.open();
this.getScriptReportService().createScriptsResultsImage(
testPlanRunID, document);
this.getMonitorReportService().createMonitorResultImages(
testPlanRunID, document);
document.close();
return FileUtils.readFileToByteArray(new File(
buildFilePath(testPlanRunID)));
} catch (Exception e) {
logger.error(ExceptionLog.getStackTrace(e));
return null;
}
}
public boolean isReportCreated(UUID testPlanRunID) {
return new File(buildFilePath(testPlanRunID)).exists();
}
public static String buildFilePath(UUID testPlanRunID) {
return PDF_FOLDER + System.getProperty("file.separator")
+ testPlanRunID + ".pdf";
}
private void isFolderExist() {
try {
if (!new File(PDF_FOLDER).isDirectory()) {
new File(PDF_FOLDER).mkdir();
}
} catch (SecurityException e) {
e.printStackTrace();
}
}
static void addParagraph(String content, Document document)
throws DocumentException {
Paragraph paragraph = new Paragraph(content);
paragraph.setAlignment(Element.ALIGN_CENTER);
document.add(paragraph);
}
public static ByteArrayOutputStream buildChartStream(Document document,
int seriesCount, List<TimeSeries> timeSeriesArray, String value)
throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JFreeChart chart = ChartFactory.createTimeSeriesChart(value,
ReportService.Time, value, buildDataSet(timeSeriesArray), true,
true, true);
adjustChartFont(value, chart);
ChartUtilities.writeChartAsPNG(outputStream, chart, PICTURE_WIDTH,
PICTURE_HIGHT);
return outputStream;
}
private static void adjustChartFont(String value, JFreeChart chart) {
Font xfont = new Font("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Font.CENTER_BASELINE, 14);// X
Font yfont = new Font("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Font.CENTER_BASELINE, 14);// Y
Font kfont = new Font("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Font.CENTER_BASELINE, 12);//
Font titleFont = new Font("΢<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>", Font.CENTER_BASELINE, 16); // title
chart.setBorderStroke(new BasicStroke(1));
chart.setBorderVisible(true);
chart.setBorderPaint(Color.cyan);
chart.setTitle(new TextTitle(value, titleFont));
XYPlot plot = chart.getXYPlot();
plot.getRangeAxis().setLabelFont(yfont);
plot.getRangeAxis().setTickLabelFont(kfont);
plot.getDomainAxis().setLabelFont(xfont);
plot.getDomainAxis().setTickLabelFont(kfont);
chart.setBackgroundPaint(java.awt.Color.white);
}
public static List<TimeSeries> buildSeries(int seriesCount, String mainTitle) {
List<TimeSeries> timeSeriesArray = new ArrayList<TimeSeries>(
seriesCount);
for (int i = 0; i < seriesCount; i++) {
timeSeriesArray.add(new TimeSeries(mainTitle + "-" + i));
}
return timeSeriesArray;
}
static TimeSeriesCollection buildDataSet(
final List<TimeSeries> timeSeriesArray) {
TimeSeriesCollection lineDataset = new TimeSeriesCollection();
if (timeSeriesArray == null) {
return null;
}
for (TimeSeries timeSeries : timeSeriesArray) {
lineDataset.addSeries(timeSeries);
}
return lineDataset;
}
public static void writeImageIntoPdf(byte[] buffer, Document document)
throws Exception {
Image image = Image.getInstance(buffer);
image.setAlignment(Element.ALIGN_CENTER);
document.add(image);
}
}

View File

@ -0,0 +1,140 @@
package org.bench4q.master.report;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.TestPlanScript;
import org.bench4q.master.domain.entity.TestPlanScriptResult;
import org.bench4q.master.domain.repository.TestPlanRepository;
import org.bench4q.master.domain.service.MonitorResultService;
import org.bench4q.master.domain.service.TestPlanScriptService;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.lowagie.text.Document;
@Component
public class ScriptReportService {
public static String SCRIPT_TITLE = "Script result";
public static String Average_Response_Time = "averageResponseTime(unit: ms)";
public static String MAX_RESPONSE_TIME = "maxResponseTime(unit : time)";
private TestPlanScriptService testPlanScriptService;
private TestPlanService testPlanService;
private TestPlanRepository testPlanRepository;
private MonitorResultService monitorResultService;
private Logger logger = Logger.getLogger(ScriptReportService.class);
public TestPlanScriptService getTestPlanScriptService() {
return testPlanScriptService;
}
@Autowired
public void setTestPlanScriptService(
TestPlanScriptService testPlanScriptService) {
this.testPlanScriptService = testPlanScriptService;
}
public TestPlanService getTestPlanService() {
return testPlanService;
}
@Autowired
public void setTestPlanService(TestPlanService testPlanService) {
this.testPlanService = testPlanService;
}
public MonitorResultService getMonitorResultService() {
return monitorResultService;
}
@Autowired
public void setMonitorResultService(
MonitorResultService monitorResultService) {
this.monitorResultService = monitorResultService;
}
private TestPlanRepository getTestPlanRepository() {
return testPlanRepository;
}
@Autowired
private void setTestPlanRepository(TestPlanRepository testPlanRepository) {
this.testPlanRepository = testPlanRepository;
}
void createScriptsResultsImage(UUID testPlanRunId, Document document) {
Set<TestPlanScript> scripts = this.getTestPlanRepository()
.getTestPlanBy(testPlanRunId).getTestPlanScripts();
if (scripts == null) {
return;
}
for (TestPlanScript testPlanScript : scripts) {
createScriptImage(this.getTestPlanScriptService()
.queryScriptBriefResults(testPlanScript), document);
}
}
private void createScriptImage(List<TestPlanScriptResult> results,
Document document) {
if (results == null) {
return;
}
createAverageReponseTimeImage(results, document);
}
private void createAverageReponseTimeImage(
List<TestPlanScriptResult> results, Document document) {
List<TimeSeries> timeSeriesList = new ArrayList<TimeSeries>();
if (results == null) {
return;
}
addScriptSeries(results, timeSeriesList, "averageResponseTime");
addScriptSeries(results, timeSeriesList, "maxResponseTime");
try {
ReportService.writeImageIntoPdf(
ReportService.buildChartStream(document,
timeSeriesList.size(), timeSeriesList,
Average_Response_Time + "&" + MAX_RESPONSE_TIME)
.toByteArray(), document);
} catch (Exception e) {
e.printStackTrace();
}
}
// TODO: refactor this to a kind of command mode
private void addScriptSeries(List<TestPlanScriptResult> results,
List<TimeSeries> timeSeriesList, String fieldName) {
try {
TimeSeries timeSeries = new TimeSeries(fieldName);
for (TestPlanScriptResult result : results) {
if (!result.getResultType().equals(
ScriptBriefResultModel.class.getName())) {
continue;
}
ScriptBriefResultModel scriptBriefResultModel = result
.extractScriptBriefResultModel();
Field field = scriptBriefResultModel.getClass()
.getDeclaredField(fieldName);
field.setAccessible(true);
timeSeries.addOrUpdate(new Second(result.getCreateDatetime()),
field.getLong(scriptBriefResultModel));
}
timeSeriesList.add(timeSeries);
} catch (Exception e) {
logger.error(e.toString()
+ " in addScriptSeries where fieldName is : " + fieldName);
}
}
}

View File

@ -0,0 +1,54 @@
package org.bench4q.master.test.report;
import static org.junit.Assert.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.bench4q.master.report.ReportService;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.junit.Test;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfWriter;
public class ReportFontTest {
@Test
public void test() {
fail("Not yet implemented");
}
public void createReportTest() throws FileNotFoundException,
DocumentException {
Document document = new Document();
PdfWriter.getInstance(
document,
new FileOutputStream(ReportService.buildFilePath(UUID
.randomUUID())));
document.open();
}
public void createTestImage(UUID id, Document document) throws IOException,
Exception {
List<TimeSeries> timeSeriesList = new ArrayList<TimeSeries>();
TimeSeries timeSeries = new TimeSeries("test");
long now = System.currentTimeMillis();
timeSeries.add(new Second(new Date(now)), 3000);
timeSeries.add(new Second(new Date(now + 100)), 4000);
timeSeriesList.add(timeSeries);
ReportService.buildSeries(1, "test");
ReportService.writeImageIntoPdf(
ReportService.buildChartStream(document, 1, timeSeriesList,
"test").toByteArray(), document);
}
}

View File

@ -1,114 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorInformation.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MonitorApi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Processor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="System.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="NetworkInterface.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PhysicalDisk.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Memory.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="LogicalDisk.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Process.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv4.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv6.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv4.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv6.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorInformation.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Processor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="System.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="NetworkInterface.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PhysicalDisk.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Memory.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="LogicalDisk.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Process.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv4.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv6.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv4.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv6.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorInformation.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MonitorApi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Processor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="System.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="NetworkInterface.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PhysicalDisk.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Memory.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="LogicalDisk.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Process.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv4.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv6.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv4.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv6.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorInformation.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Processor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="System.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="NetworkInterface.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PhysicalDisk.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Memory.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="LogicalDisk.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Process.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv4.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv6.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv4.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv6.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,163 +1,163 @@
#include "stdafx.h"
#include "Monitor.h"
#include "Common.h"
#include "System.h"
list<wstring> System::GetCounterList()
{
return Common::GetCounterList(L"System");
}
// File Read Operations/sec
double System::GetFileReadOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Operations/sec
double System::GetFileWriteOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Operations/sec
double System::GetFileControlOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Read Bytes/sec
double System::GetFileReadBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Bytes/sec
double System::GetFileWriteBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Bytes/sec
double System::GetFileControlBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Context Switches/sec
double System::GetContextSwitchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Context Switches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Calls/sec
double System::GetSystemCallsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Calls/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Data Operations/sec
double System::GetFileDataOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Data Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Up Time
double System::GetSystemUpTime()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Up Time";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processor Queue Length
double System::GetProcessorQueueLength()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processor Queue Length";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processes
double System::GetProcessesCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processes";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Threads
double System::GetThreadsCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Threads";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Alignment Fixups/sec
double System::GetAlignmentFixupsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Alignment Fixups/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Exception Dispatches/sec
double System::GetExceptionDispatchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Exception Dispatches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Floating Emulations/sec
double System::GetFloatingEmulationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Floating Emulations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// % Registry Quota In Use
double System::GetRegistryQuotaInUsePercent()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\% Registry Quota In Use";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
#include "stdafx.h"
#include "Monitor.h"
#include "Common.h"
#include "System.h"
list<wstring> System::GetCounterList()
{
return Common::GetCounterList(L"System");
}
// File Read Operations/sec
double System::GetFileReadOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Operations/sec
double System::GetFileWriteOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Operations/sec
double System::GetFileControlOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Read Bytes/sec
double System::GetFileReadBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Read Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Write Bytes/sec
double System::GetFileWriteBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Write Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Control Bytes/sec
double System::GetFileControlBytesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Control Bytes/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Context Switches/sec
double System::GetContextSwitchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Context Switches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Calls/sec
double System::GetSystemCallsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Calls/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// File Data Operations/sec
double System::GetFileDataOperationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\File Data Operations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// System Up Time
double System::GetSystemUpTime()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\System Up Time";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processor Queue Length
double System::GetProcessorQueueLength()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processor Queue Length";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Processes
double System::GetProcessesCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Processes";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Threads
double System::GetThreadsCount()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Threads";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}
// Alignment Fixups/sec
double System::GetAlignmentFixupsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Alignment Fixups/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Exception Dispatches/sec
double System::GetExceptionDispatchesPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Exception Dispatches/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// Floating Emulations/sec
double System::GetFloatingEmulationsPerSecond(int idleTime)
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\Floating Emulations/sec";
double ret=Common::GetCounterValueWithIdle(fullCounterPath.c_str(),idleTime);
return ret;
}
// % Registry Quota In Use
double System::GetRegistryQuotaInUsePercent()
{
wstring fullCounterPath(L"");
fullCounterPath+=L"\\System\\% Registry Quota In Use";
double ret=Common::GetCounterValue(fullCounterPath.c_str());
return ret;
}

View File

@ -1,205 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{286E6C20-9603-4870-BD34-FF54406AE1DC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Native</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Common.h" />
<ClInclude Include="LogicalDiskMonitor.h" />
<ClInclude Include="MemoryMonitor.h" />
<ClInclude Include="MonitorApi.h" />
<ClInclude Include="Native.h" />
<ClInclude Include="NetworkInterfaceMonitor.h" />
<ClInclude Include="PhysicalDiskMonitor.h" />
<ClInclude Include="ProcessMonitor.h" />
<ClInclude Include="ProcessorInformationMonitor.h" />
<ClInclude Include="ProcessorMonitor.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="SystemMonitor.h" />
<ClInclude Include="TCPv4Monitor.h" />
<ClInclude Include="TCPv6Monitor.h" />
<ClInclude Include="UDPv4Monitor.h" />
<ClInclude Include="UDPv6Monitor.h" />
<ClInclude Include="标头.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Common.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="LogicalDiskMonitor.cpp" />
<ClCompile Include="MemoryMonitor.cpp" />
<ClCompile Include="NetworkInterfaceMonitor.cpp" />
<ClCompile Include="PhysicalDiskMonitor.cpp" />
<ClCompile Include="ProcessMonitor.cpp" />
<ClCompile Include="ProcessorInformationMonitor.cpp" />
<ClCompile Include="ProcessorMonitor.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SystemMonitor.cpp" />
<ClCompile Include="TCPv4Monitor.cpp" />
<ClCompile Include="TCPv6Monitor.cpp" />
<ClCompile Include="UDPv4Monitor.cpp" />
<ClCompile Include="UDPv6Monitor.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{286E6C20-9603-4870-BD34-FF54406AE1DC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Native</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(JAVA_HOME)/include/win32;$(JAVA_HOME)/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Common.h" />
<ClInclude Include="LogicalDiskMonitor.h" />
<ClInclude Include="MemoryMonitor.h" />
<ClInclude Include="MonitorApi.h" />
<ClInclude Include="Native.h" />
<ClInclude Include="NetworkInterfaceMonitor.h" />
<ClInclude Include="PhysicalDiskMonitor.h" />
<ClInclude Include="ProcessMonitor.h" />
<ClInclude Include="ProcessorInformationMonitor.h" />
<ClInclude Include="ProcessorMonitor.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="SystemMonitor.h" />
<ClInclude Include="TCPv4Monitor.h" />
<ClInclude Include="TCPv6Monitor.h" />
<ClInclude Include="UDPv4Monitor.h" />
<ClInclude Include="UDPv6Monitor.h" />
<ClInclude Include="标头.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Common.cpp" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="LogicalDiskMonitor.cpp" />
<ClCompile Include="MemoryMonitor.cpp" />
<ClCompile Include="NetworkInterfaceMonitor.cpp" />
<ClCompile Include="PhysicalDiskMonitor.cpp" />
<ClCompile Include="ProcessMonitor.cpp" />
<ClCompile Include="ProcessorInformationMonitor.cpp" />
<ClCompile Include="ProcessorMonitor.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SystemMonitor.cpp" />
<ClCompile Include="TCPv4Monitor.cpp" />
<ClCompile Include="TCPv6Monitor.cpp" />
<ClCompile Include="UDPv4Monitor.cpp" />
<ClCompile Include="UDPv6Monitor.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,117 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Native.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MonitorApi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="LogicalDiskMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MemoryMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="NetworkInterfaceMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv4Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv6Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PhysicalDiskMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv4Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv6Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorInformationMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="标头.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="SystemMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="LogicalDiskMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MemoryMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="NetworkInterfaceMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv4Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv6Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PhysicalDiskMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv4Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv6Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorInformationMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="SystemMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Native.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MonitorApi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="LogicalDiskMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MemoryMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="NetworkInterfaceMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv4Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="TCPv6Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="PhysicalDiskMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv4Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="UDPv6Monitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorInformationMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="ProcessorMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="标头.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="SystemMonitor.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="LogicalDiskMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MemoryMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="NetworkInterfaceMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv4Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="TCPv6Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="PhysicalDiskMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv4Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="UDPv6Monitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorInformationMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="ProcessorMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="SystemMonitor.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,41 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>publish</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<files>
<file>
<source>target/bench4q-monitor.jar</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>WindowsMonitor/Release/Monitor.dll</source>
<outputDirectory>/lib/x86</outputDirectory>
</file>
<file>
<source>WindowsMonitor/Release/Native.dll</source>
<outputDirectory>/lib/x86</outputDirectory>
</file>
<file>
<source>WindowsMonitor/x64/Release/Monitor.dll</source>
<outputDirectory>/lib/x64</outputDirectory>
</file>
<file>
<source>WindowsMonitor/x64/Release/Native.dll</source>
<outputDirectory>/lib/x64</outputDirectory>
</file>
</files>
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>publish</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<files>
<file>
<source>target/bench4q-monitor.jar</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>WindowsMonitor/Release/Monitor.dll</source>
<outputDirectory>/lib/x86</outputDirectory>
</file>
<file>
<source>WindowsMonitor/Release/Native.dll</source>
<outputDirectory>/lib/x86</outputDirectory>
</file>
<file>
<source>WindowsMonitor/x64/Release/Monitor.dll</source>
<outputDirectory>/lib/x64</outputDirectory>
</file>
<file>
<source>WindowsMonitor/x64/Release/Native.dll</source>
<outputDirectory>/lib/x64</outputDirectory>
</file>
</files>
</assembly>

View File

@ -1,87 +1,87 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.bench4q</groupId>
<artifactId>bench4q-monitor</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Bench4Q Monitor</name>
<description>Bench4Q Monitor</description>
<organization>
<name>TCSE, ISCAS</name>
</organization>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.11.v20130520</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.11.v20130520</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.bench4q.monitor.Main</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<finalName>bench4q-monitor</finalName>
</build>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.bench4q</groupId>
<artifactId>bench4q-monitor</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Bench4Q Monitor</name>
<description>Bench4Q Monitor</description>
<organization>
<name>TCSE, ISCAS</name>
</organization>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>8.1.11.v20130520</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>8.1.11.v20130520</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.bench4q.monitor.Main</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<finalName>bench4q-monitor</finalName>
</build>
</project>

View File

@ -1,56 +1,56 @@
package org.bench4q.monitor;
import java.io.File;
public class Main {
static {
loadLibraries();
}
private static void loadLibraries() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
String directory = Main.class.getProtectionDomain().getCodeSource()
.getLocation().getFile().replace("\\", "/");
File file = new File(directory);
if (!file.isDirectory()) {
directory = directory.substring(0, directory.lastIndexOf("/"));
if (!directory.endsWith("/")) {
directory += "/";
}
int arch = Integer.parseInt(System
.getProperty("sun.arch.data.model"));
if (arch == 64) {
System.load(directory + "lib/x64/Monitor.dll");
System.load(directory + "lib/x64/Native.dll");
} else {
System.load(directory + "lib/x86/Monitor.dll");
System.load(directory + "lib/x86/Native.dll");
}
} else {
// In IDE
String userDir = System.getProperty("user.dir").replace("\\",
"/");
userDir += "/WindowsMonitor";
int arch = Integer.parseInt(System
.getProperty("sun.arch.data.model"));
if (arch == 64) {
System.load(userDir + "/x64/Release/Monitor.dll");
System.load(userDir + "/x64/Release/Native.dll");
} else {
System.load(userDir + "/Release/Monitor.dll");
System.load(userDir + "/Release/Native.dll");
}
}
}
}
public static void main(String[] args) {
if (System.getProperty("os.name").toLowerCase().contains("windows"))
loadLibraries();
MonitorServer monitorServer = new MonitorServer(5556);
monitorServer.start();
}
}
package org.bench4q.monitor;
import java.io.File;
public class Main {
static {
loadLibraries();
}
private static void loadLibraries() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("windows")) {
String directory = Main.class.getProtectionDomain().getCodeSource()
.getLocation().getFile().replace("\\", "/");
File file = new File(directory);
if (!file.isDirectory()) {
directory = directory.substring(0, directory.lastIndexOf("/"));
if (!directory.endsWith("/")) {
directory += "/";
}
int arch = Integer.parseInt(System
.getProperty("sun.arch.data.model"));
if (arch == 64) {
System.load(directory + "lib/x64/Monitor.dll");
System.load(directory + "lib/x64/Native.dll");
} else {
System.load(directory + "lib/x86/Monitor.dll");
System.load(directory + "lib/x86/Native.dll");
}
} else {
// In IDE
String userDir = System.getProperty("user.dir").replace("\\",
"/");
userDir += "/WindowsMonitor";
int arch = Integer.parseInt(System
.getProperty("sun.arch.data.model"));
if (arch == 64) {
System.load(userDir + "/x64/Release/Monitor.dll");
System.load(userDir + "/x64/Release/Native.dll");
} else {
System.load(userDir + "/Release/Monitor.dll");
System.load(userDir + "/Release/Native.dll");
}
}
}
}
public static void main(String[] args) {
if (System.getProperty("os.name").toLowerCase().contains("windows"))
loadLibraries();
MonitorServer monitorServer = new MonitorServer(5556);
monitorServer.start();
}
}

View File

@ -1,70 +1,70 @@
package org.bench4q.monitor;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.springframework.web.servlet.DispatcherServlet;
public class MonitorServer {
private Server server;
private int port;
private Server getServer() {
return server;
}
private void setServer(Server server) {
this.server = server;
}
private int getPort() {
return port;
}
private void setPort(int port) {
this.port = port;
}
public MonitorServer(int port) {
this.setPort(port);
}
public boolean start() {
try {
System.out.println(this.getPort());
this.setServer(new Server());
Connector connector = new SocketConnector();
connector.setPort(this.getPort());
this.getServer().addConnector(connector);
ServletContextHandler servletContextHandler = new ServletContextHandler();
ServletHolder servletHolder = servletContextHandler.addServlet(
DispatcherServlet.class, "/");
servletHolder
.setInitParameter("contextConfigLocation",
"classpath*:org/bench4q/monitor/config/application-context.xml");
this.getServer().setHandler(servletContextHandler);
this.getServer().start();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean stop() {
try {
if (this.getServer() != null) {
this.getServer().stop();
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
this.setServer(null);
}
}
}
package org.bench4q.monitor;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.springframework.web.servlet.DispatcherServlet;
public class MonitorServer {
private Server server;
private int port;
private Server getServer() {
return server;
}
private void setServer(Server server) {
this.server = server;
}
private int getPort() {
return port;
}
private void setPort(int port) {
this.port = port;
}
public MonitorServer(int port) {
this.setPort(port);
}
public boolean start() {
try {
System.out.println(this.getPort());
this.setServer(new Server());
Connector connector = new SocketConnector();
connector.setPort(this.getPort());
this.getServer().addConnector(connector);
ServletContextHandler servletContextHandler = new ServletContextHandler();
ServletHolder servletHolder = servletContextHandler.addServlet(
DispatcherServlet.class, "/");
servletHolder
.setInitParameter("contextConfigLocation",
"classpath*:org/bench4q/monitor/config/application-context.xml");
this.getServer().setHandler(servletContextHandler);
this.getServer().start();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean stop() {
try {
if (this.getServer() != null) {
this.getServer().stop();
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
this.setServer(null);
}
}
}

View File

@ -1,35 +1,35 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.LogicalDiskModel;
import org.bench4q.monitor.service.linux.LogicalDiskServiceLinux;
import org.bench4q.monitor.service.windows.LogicalDiskServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value = "/Monitor", method = { RequestMethod.GET,
RequestMethod.POST })
public class LogicalDiskController extends MonitorContorlEntity {// <EFBFBD>Ժ<EFBFBD>ʵ<EFBFBD><EFBFBD>linux<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>linux<EFBFBD><EFBFBD>dervice
@RequestMapping("/LogicalDisk")
@ResponseBody
public LogicalDiskModel getLogicalDiskInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
LogicalDiskServiceWindows logicalDiskServiceWindows = new LogicalDiskServiceWindows();
return logicalDiskServiceWindows.getLogicalDiskInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
LogicalDiskServiceLinux logicalDiskServiceLinux = new LogicalDiskServiceLinux();
return logicalDiskServiceLinux.getLogicalDiskInfo(this
.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.LogicalDiskModel;
import org.bench4q.monitor.service.linux.LogicalDiskServiceLinux;
import org.bench4q.monitor.service.windows.LogicalDiskServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping(value = "/Monitor", method = { RequestMethod.GET,
RequestMethod.POST })
public class LogicalDiskController extends MonitorContorlEntity {// <EFBFBD>Ժ<EFBFBD>ʵ<EFBFBD><EFBFBD>linux<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>linux<EFBFBD><EFBFBD>dervice
@RequestMapping("/LogicalDisk")
@ResponseBody
public LogicalDiskModel getLogicalDiskInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
LogicalDiskServiceWindows logicalDiskServiceWindows = new LogicalDiskServiceWindows();
return logicalDiskServiceWindows.getLogicalDiskInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
LogicalDiskServiceLinux logicalDiskServiceLinux = new LogicalDiskServiceLinux();
return logicalDiskServiceLinux.getLogicalDiskInfo(this
.getIdleTime());
} else
return null;
}
}

View File

@ -1,33 +1,33 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.MemoryModel;
import org.bench4q.monitor.service.linux.MemoryServiceLinux;
import org.bench4q.monitor.service.windows.MemoryServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class MemoryController extends MonitorContorlEntity {
@RequestMapping(value = "/Memory", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public MemoryModel getMemoryInfo() throws NumberFormatException,
IOException {
if (this.getOsNameString().contains("windows")) {
MemoryServiceWindows memoryServiceWindows = new MemoryServiceWindows();
return memoryServiceWindows.getMemoryInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
MemoryServiceLinux memoryServiceLinux = new MemoryServiceLinux();
return memoryServiceLinux.getMemoryInfo(this.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.MemoryModel;
import org.bench4q.monitor.service.linux.MemoryServiceLinux;
import org.bench4q.monitor.service.windows.MemoryServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class MemoryController extends MonitorContorlEntity {
@RequestMapping(value = "/Memory", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public MemoryModel getMemoryInfo() throws NumberFormatException,
IOException {
if (this.getOsNameString().contains("windows")) {
MemoryServiceWindows memoryServiceWindows = new MemoryServiceWindows();
return memoryServiceWindows.getMemoryInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
MemoryServiceLinux memoryServiceLinux = new MemoryServiceLinux();
return memoryServiceLinux.getMemoryInfo(this.getIdleTime());
} else
return null;
}
}

View File

@ -1,33 +1,33 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.service.linux.NetworkInterfaceServiceLinux;
import org.bench4q.monitor.service.windows.NetworkInterfaceServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class NetworkInterfaceController extends MonitorContorlEntity {
@RequestMapping("/NetworkInterface")
@ResponseBody
public NetworkInterfaceModel getNetworkInterfaceInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
NetworkInterfaceServiceWindows networkInterfaceServiceWindows = new NetworkInterfaceServiceWindows();
return networkInterfaceServiceWindows.getNetworkInterfaceInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
NetworkInterfaceServiceLinux networkInterfaceServiceLinux = new NetworkInterfaceServiceLinux();
return networkInterfaceServiceLinux.getNetworkInterfaceInfo(this
.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.service.linux.NetworkInterfaceServiceLinux;
import org.bench4q.monitor.service.windows.NetworkInterfaceServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class NetworkInterfaceController extends MonitorContorlEntity {
@RequestMapping("/NetworkInterface")
@ResponseBody
public NetworkInterfaceModel getNetworkInterfaceInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
NetworkInterfaceServiceWindows networkInterfaceServiceWindows = new NetworkInterfaceServiceWindows();
return networkInterfaceServiceWindows.getNetworkInterfaceInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
NetworkInterfaceServiceLinux networkInterfaceServiceLinux = new NetworkInterfaceServiceLinux();
return networkInterfaceServiceLinux.getNetworkInterfaceInfo(this
.getIdleTime());
} else
return null;
}
}

View File

@ -1,33 +1,33 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.service.linux.PhysicalDiskServiceLinux;
import org.bench4q.monitor.service.windows.PhysicalDiskServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class PhysicalDiskController extends MonitorContorlEntity {
@RequestMapping("/PhysicalDisk")
@ResponseBody
public PhysicalDiskModel getPhysicalDislInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
PhysicalDiskServiceWindows physicalDiskServiceWindows = new PhysicalDiskServiceWindows();
return physicalDiskServiceWindows.getPhysicalDiskInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
PhysicalDiskServiceLinux physicalDiskServiceLinux = new PhysicalDiskServiceLinux();
return physicalDiskServiceLinux.getPhysicalFDiskInfo(this
.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.service.linux.PhysicalDiskServiceLinux;
import org.bench4q.monitor.service.windows.PhysicalDiskServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class PhysicalDiskController extends MonitorContorlEntity {
@RequestMapping("/PhysicalDisk")
@ResponseBody
public PhysicalDiskModel getPhysicalDislInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
PhysicalDiskServiceWindows physicalDiskServiceWindows = new PhysicalDiskServiceWindows();
return physicalDiskServiceWindows.getPhysicalDiskInfo(this
.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
PhysicalDiskServiceLinux physicalDiskServiceLinux = new PhysicalDiskServiceLinux();
return physicalDiskServiceLinux.getPhysicalFDiskInfo(this
.getIdleTime());
} else
return null;
}
}

View File

@ -1,36 +1,36 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.service.linux.ProcessServiceLinux;
import org.bench4q.monitor.service.windows.ProcessServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class ProcessController extends MonitorContorlEntity {
@RequestMapping("/Process")
@ResponseBody
public ProcessModel getProcessInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
ProcessServiceWindows processServiceWindows = new ProcessServiceWindows();
return processServiceWindows.getProcessInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
ProcessServiceLinux processServiceLinux = new ProcessServiceLinux();
// ProcessModel processModel =
// processServiceLinux.getProcessInfo(this
// .getIdleTime());
return processServiceLinux.getProcessInfo(this.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.service.linux.ProcessServiceLinux;
import org.bench4q.monitor.service.windows.ProcessServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class ProcessController extends MonitorContorlEntity {
@RequestMapping("/Process")
@ResponseBody
public ProcessModel getProcessInfo() throws IOException,
InterruptedException {
if (this.getOsNameString().contains("windows")) {
ProcessServiceWindows processServiceWindows = new ProcessServiceWindows();
return processServiceWindows.getProcessInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
ProcessServiceLinux processServiceLinux = new ProcessServiceLinux();
// ProcessModel processModel =
// processServiceLinux.getProcessInfo(this
// .getIdleTime());
return processServiceLinux.getProcessInfo(this.getIdleTime());
} else
return null;
}
}

View File

@ -1,35 +1,35 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.ProcessorModel;
import org.bench4q.monitor.service.linux.ProcessorServiceLinux;
import org.bench4q.monitor.service.windows.ProcessorServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class ProcessorController extends MonitorContorlEntity {
@RequestMapping("/Processor")
@ResponseBody
public ProcessorModel getProcessorInfo() throws IOException, InterruptedException {
if (this.getOsNameString().contains("windows")) {
ProcessorServiceWindows processorServiceWindows=new ProcessorServiceWindows();
return processorServiceWindows.getProcessorInfo(
this.getIdleTime());
}
else if (this.getOsNameString().contains("linux")){
ProcessorServiceLinux processorServiceLinux=new ProcessorServiceLinux();
return processorServiceLinux.getProcessorInfo(
this.getIdleTime());
}
else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.ProcessorModel;
import org.bench4q.monitor.service.linux.ProcessorServiceLinux;
import org.bench4q.monitor.service.windows.ProcessorServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class ProcessorController extends MonitorContorlEntity {
@RequestMapping("/Processor")
@ResponseBody
public ProcessorModel getProcessorInfo() throws IOException, InterruptedException {
if (this.getOsNameString().contains("windows")) {
ProcessorServiceWindows processorServiceWindows=new ProcessorServiceWindows();
return processorServiceWindows.getProcessorInfo(
this.getIdleTime());
}
else if (this.getOsNameString().contains("linux")){
ProcessorServiceLinux processorServiceLinux=new ProcessorServiceLinux();
return processorServiceLinux.getProcessorInfo(
this.getIdleTime());
}
else
return null;
}
}

View File

@ -1,28 +1,28 @@
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.SystemModel;
import org.bench4q.monitor.service.linux.SystemServiceLinux;
import org.bench4q.monitor.service.windows.SystemServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class SystemController extends MonitorContorlEntity {
@ResponseBody
@RequestMapping("/System")
public SystemModel getSystemInfo() throws IOException, InterruptedException {
if (this.getOsNameString().contains("windows")) {
SystemServiceWindows systemServiceWindows = new SystemServiceWindows();
return systemServiceWindows.getSystemInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
SystemServiceLinux systemServiceLinux = new SystemServiceLinux();
return systemServiceLinux.getSystemInfo(this.getIdleTime());
} else
return null;
}
}
package org.bench4q.monitor.api;
import java.io.IOException;
import org.bench4q.monitor.entiry.MonitorContorlEntity;
import org.bench4q.monitor.model.SystemModel;
import org.bench4q.monitor.service.linux.SystemServiceLinux;
import org.bench4q.monitor.service.windows.SystemServiceWindows;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("/Monitor")
public class SystemController extends MonitorContorlEntity {
@ResponseBody
@RequestMapping("/System")
public SystemModel getSystemInfo() throws IOException, InterruptedException {
if (this.getOsNameString().contains("windows")) {
SystemServiceWindows systemServiceWindows = new SystemServiceWindows();
return systemServiceWindows.getSystemInfo(this.getIdleTime());
} else if (this.getOsNameString().contains("linux")) {
SystemServiceLinux systemServiceLinux = new SystemServiceLinux();
return systemServiceLinux.getSystemInfo(this.getIdleTime());
} else
return null;
}
}

View File

@ -1,25 +1,25 @@
package org.bench4q.monitor.entiry;
public class MonitorContorlEntity {
private String osNameString;
private int idleTime;
public MonitorContorlEntity(){
this.osNameString=System.getProperty("os.name").toLowerCase();
this.idleTime=3000;
}
public String getOsNameString() {
return osNameString;
}
public void setOsNameString(String osNameString) {
this.osNameString = osNameString;
}
public int getIdleTime() {
return idleTime;
}
public void setIdleTime(int idleTime) {
this.idleTime = idleTime;
}
}
package org.bench4q.monitor.entiry;
public class MonitorContorlEntity {
private String osNameString;
private int idleTime;
public MonitorContorlEntity(){
this.osNameString=System.getProperty("os.name").toLowerCase();
this.idleTime=3000;
}
public String getOsNameString() {
return osNameString;
}
public void setOsNameString(String osNameString) {
this.osNameString = osNameString;
}
public int getIdleTime() {
return idleTime;
}
public void setIdleTime(int idleTime) {
this.idleTime = idleTime;
}
}

View File

@ -1,37 +1,37 @@
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.performance.linux.NetworkInterfaceMonitor;
import org.bench4q.monitor.files.Write;
public class WriteNetworkInterfaceLinux extends Write {
private NetworkInterfaceMonitor networkInterfaceMonitor;
public WriteNetworkInterfaceLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.networkInterfaceMonitor = new NetworkInterfaceMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(NetworkInterfaceModel.class);
Marshaller marshaller = context.createMarshaller();
NetworkInterfaceModel networkInterfaceModel = networkInterfaceMonitor
.getNetworkInterfaceInfo(idleTime);
marshaller.marshal(networkInterfaceModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.performance.linux.NetworkInterfaceMonitor;
import org.bench4q.monitor.files.Write;
public class WriteNetworkInterfaceLinux extends Write {
private NetworkInterfaceMonitor networkInterfaceMonitor;
public WriteNetworkInterfaceLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.networkInterfaceMonitor = new NetworkInterfaceMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(NetworkInterfaceModel.class);
Marshaller marshaller = context.createMarshaller();
NetworkInterfaceModel networkInterfaceModel = networkInterfaceMonitor
.getNetworkInterfaceInfo(idleTime);
marshaller.marshal(networkInterfaceModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,38 +1,38 @@
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.performance.linux.PhysicalDiskMonitor;
import org.bench4q.monitor.files.Write;
public class WritePhysicalDiskLinux extends Write {
private PhysicalDiskMonitor physicalDiskMonitor;
public WritePhysicalDiskLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.physicalDiskMonitor = new PhysicalDiskMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(PhysicalDiskModel.class);
Marshaller marshaller = context.createMarshaller();
PhysicalDiskModel physicalDiskModel = physicalDiskMonitor
.getPhysicalDiskInfo(idleTime);
marshaller.marshal(physicalDiskModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.performance.linux.PhysicalDiskMonitor;
import org.bench4q.monitor.files.Write;
public class WritePhysicalDiskLinux extends Write {
private PhysicalDiskMonitor physicalDiskMonitor;
public WritePhysicalDiskLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.physicalDiskMonitor = new PhysicalDiskMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(PhysicalDiskModel.class);
Marshaller marshaller = context.createMarshaller();
PhysicalDiskModel physicalDiskModel = physicalDiskMonitor
.getPhysicalDiskInfo(idleTime);
marshaller.marshal(physicalDiskModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,33 +1,33 @@
package org.bench4q.monitor.file.Linux;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.performance.linux.ProcessMonitor;
import org.bench4q.monitor.files.Write;
public class WriteProcessLinux extends Write {
private ProcessMonitor processMonitor;
public WriteProcessLinux(PrintWriter out, int idleTime) {
this.out = out;
this.processMonitor = new ProcessMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessModel processModel = processMonitor.getProcessInfo(idleTime);
marshaller.marshal(processModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.Linux;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.performance.linux.ProcessMonitor;
import org.bench4q.monitor.files.Write;
public class WriteProcessLinux extends Write {
private ProcessMonitor processMonitor;
public WriteProcessLinux(PrintWriter out, int idleTime) {
this.out = out;
this.processMonitor = new ProcessMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessModel processModel = processMonitor.getProcessInfo(idleTime);
marshaller.marshal(processModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,36 +1,36 @@
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessorModel;
import org.bench4q.monitor.performance.linux.ProcessorMonitor;
import org.bench4q.monitor.files.Write;
public class WriteProcessorLinux extends Write {
private ProcessorMonitor processorMonitor;
public WriteProcessorLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.processorMonitor = new ProcessorMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessorModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessorModel processorModel = processorMonitor
.getProcessorInfo(idleTime);
marshaller.marshal(processorModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.Linux;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessorModel;
import org.bench4q.monitor.performance.linux.ProcessorMonitor;
import org.bench4q.monitor.files.Write;
public class WriteProcessorLinux extends Write {
private ProcessorMonitor processorMonitor;
public WriteProcessorLinux(PrintWriter out, int idleTime)
throws FileNotFoundException {
this.out = out;
this.processorMonitor = new ProcessorMonitor();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessorModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessorModel processorModel = processorMonitor
.getProcessorInfo(idleTime);
marshaller.marshal(processorModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,35 +1,35 @@
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.service.windows.NetworkInterfaceServiceWindows;
import org.bench4q.monitor.files.Write;
public class WriteNetworkInterfaceWindows extends Write {
private NetworkInterfaceServiceWindows networkInterfaceServiceWindows;
public WriteNetworkInterfaceWindows(PrintWriter out, int idleTime) {
this.out = out;
this.networkInterfaceServiceWindows = new NetworkInterfaceServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(NetworkInterfaceModel.class);
Marshaller marshaller = context.createMarshaller();
NetworkInterfaceModel networkInterfaceModel = networkInterfaceServiceWindows
.getNetworkInterfaceInfo(idleTime);
marshaller.marshal(networkInterfaceModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.NetworkInterfaceModel;
import org.bench4q.monitor.service.windows.NetworkInterfaceServiceWindows;
import org.bench4q.monitor.files.Write;
public class WriteNetworkInterfaceWindows extends Write {
private NetworkInterfaceServiceWindows networkInterfaceServiceWindows;
public WriteNetworkInterfaceWindows(PrintWriter out, int idleTime) {
this.out = out;
this.networkInterfaceServiceWindows = new NetworkInterfaceServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(NetworkInterfaceModel.class);
Marshaller marshaller = context.createMarshaller();
NetworkInterfaceModel networkInterfaceModel = networkInterfaceServiceWindows
.getNetworkInterfaceInfo(idleTime);
marshaller.marshal(networkInterfaceModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,36 +1,36 @@
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.service.windows.PhysicalDiskServiceWindows;
import org.bench4q.monitor.files.Write;
public class WritePhysicalDiskWindows extends Write {
private PhysicalDiskServiceWindows physicalDiskServiceWindows;
public WritePhysicalDiskWindows(PrintWriter out, int idleTime) {
this.out = out;
this.physicalDiskServiceWindows = new PhysicalDiskServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(PhysicalDiskModel.class);
Marshaller marshaller = context.createMarshaller();
PhysicalDiskModel physicalDiskModel = physicalDiskServiceWindows
.getPhysicalDiskInfo(idleTime);
marshaller.marshal(physicalDiskModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.PhysicalDiskModel;
import org.bench4q.monitor.service.windows.PhysicalDiskServiceWindows;
import org.bench4q.monitor.files.Write;
public class WritePhysicalDiskWindows extends Write {
private PhysicalDiskServiceWindows physicalDiskServiceWindows;
public WritePhysicalDiskWindows(PrintWriter out, int idleTime) {
this.out = out;
this.physicalDiskServiceWindows = new PhysicalDiskServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext
.newInstance(PhysicalDiskModel.class);
Marshaller marshaller = context.createMarshaller();
PhysicalDiskModel physicalDiskModel = physicalDiskServiceWindows
.getPhysicalDiskInfo(idleTime);
marshaller.marshal(physicalDiskModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

View File

@ -1,34 +1,34 @@
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.service.windows.ProcessServiceWindows;
import org.bench4q.monitor.files.Write;
public class WriteProcessWindows extends Write {
private ProcessServiceWindows processServiceWindows;
public WriteProcessWindows(PrintWriter out, int idleTime) {
this.out = out;
this.processServiceWindows = new ProcessServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessModel processModel = processServiceWindows
.getProcessInfo(idleTime);
marshaller.marshal(processModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}
package org.bench4q.monitor.file.windows;
import java.io.PrintWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.bench4q.monitor.model.ProcessModel;
import org.bench4q.monitor.service.windows.ProcessServiceWindows;
import org.bench4q.monitor.files.Write;
public class WriteProcessWindows extends Write {
private ProcessServiceWindows processServiceWindows;
public WriteProcessWindows(PrintWriter out, int idleTime) {
this.out = out;
this.processServiceWindows = new ProcessServiceWindows();
this.idleTime = idleTime;
}
public void run() {
try {
JAXBContext context = JAXBContext.newInstance(ProcessModel.class);
Marshaller marshaller = context.createMarshaller();
ProcessModel processModel = processServiceWindows
.getProcessInfo(idleTime);
marshaller.marshal(processModel, out);
} catch (Exception e) {
System.out.println(e);
}
}
}

Some files were not shown because too many files have changed in this diff Show More