Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-01-22 08:03:04 -0500
committerSami Wagiaalla2013-01-22 11:26:44 -0500
commit7be373946e5b4b6267842f9ed34d63f4c63bbb37 (patch)
tree50eb8a8e86cbd99060723a750465ba7d6ffaa1ea
parent1817168a7099c637370efb7f46325e37d21e4c01 (diff)
downloadorg.eclipse.linuxtools-7be373946e5b4b6267842f9ed34d63f4c63bbb37.tar.gz
org.eclipse.linuxtools-7be373946e5b4b6267842f9ed34d63f4c63bbb37.tar.xz
org.eclipse.linuxtools-7be373946e5b4b6267842f9ed34d63f4c63bbb37.zip
Drop threadprofiler.
It is not-finished, not-documented and not-tested. If someone wants to revive back please consider getting it in better shape first. Change-Id: I29e76882fcbb3795f45dfdcde99f46c928fa8ec0 Reviewed-on: https://git.eclipse.org/r/9832 Reviewed-by: Sami Wagiaalla <swagiaal@redhat.com> IP-Clean: Sami Wagiaalla <swagiaal@redhat.com> Tested-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/.gitignore5
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/.project17
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/build.properties3
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.properties112
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.xml27
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/p2.inf3
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler.feature/pom.xml26
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/.classpath7
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/.gitignore5
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/.project34
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/Axis.pngbin3158 -> 0 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/META-INF/MANIFEST.MF15
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/ThreadProfile.stp85
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/build.properties6
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/graphtest.stp7
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/icons/pause.gifbin230 -> 0 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/icons/perform.pngbin1038 -> 0 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/plugin.xml77
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/pom.xml26
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/CircularPointBuffer.java88
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/DataPoint.java73
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphColorScheme.java85
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphCoordinateSystem.java106
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphPointBuffer.java32
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/LaunchThreadProfiler.java51
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerParser.java71
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerPlugin.java98
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerView.java453
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/TransformationMatrix.java79
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/GraphModel.java256
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/MultiGraph.java157
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/ThreadGraph.java92
-rw-r--r--systemtap/org.eclipse.linuxtools.threadprofiler/threadprofiler.patch1237
-rw-r--r--systemtap/pom.xml2
35 files changed, 0 insertions, 3343 deletions
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.gitignore b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.gitignore
deleted file mode 100644
index 8d94ef8deb..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-@dot
-javaCompiler...args
-build.xml
-target
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.project b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.project
deleted file mode 100644
index 2116e4d567..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.linuxtools.threadprofiler.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/build.properties b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/build.properties
deleted file mode 100644
index e2bd14c5f3..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-bin.includes = feature.xml,\
- p2.inf,\
- feature.properties
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.properties b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.properties
deleted file mode 100644
index aa1fe289b7..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.properties
+++ /dev/null
@@ -1,112 +0,0 @@
-#*******************************************************************************
-# Copyright (c) 2008 Red Hat, Inc.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Red Hat, Inc. - initial API and implementation
-#********************************************************************************
-featureName=Thread Profiler
-description=SystemTap-based profiling tool for threaded C/C++ programs
-featureProvider=Eclipse Linux Tools
-copyright=Copyright 2009 Red Hat, Inc.
-licenseURL=epl-v10.html
-license=\
-ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\
-March 17, 2005\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\
-is provided to you under the terms and conditions of the Eclipse Public\n\
-License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\
-Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse.org CVS\n\
-repository ("Repository") in CVS modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-Features may also include other Features ("Included Features"). Files named\n\
-"feature.xml" may contain a list of the names and version numbers of\n\
-Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Eclipse Update Manager, you must agree to a license ("Feature Update\n\
-License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties". Such Abouts,\n\
-Feature Licenses and Feature Update Licenses contain the terms and\n\
-conditions (or references to such terms and conditions) that govern your\n\
-use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use,\n\
-and re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.xml b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.xml
deleted file mode 100644
index fb72d37812..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/feature.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.linuxtools.threadprofiler.feature"
- label="%featureName"
- version="1.0.0.qualifier"
- provider-name="%featureProvider">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <plugin
- id="org.eclipse.linuxtools.threadprofiler"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/p2.inf b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/p2.inf
deleted file mode 100644
index 5246a0c824..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/p2.inf
+++ /dev/null
@@ -1,3 +0,0 @@
-instructions.configure=\
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/linuxtools/updates-nightly,type:0,name:Linux Tools,enabled:false); \
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/linuxtools/updates-nightly,type:1,name:Linux Tools,enabled:false);
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/pom.xml b/systemtap/org.eclipse.linuxtools.threadprofiler.feature/pom.xml
deleted file mode 100644
index 6fef376153..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler.feature/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>linuxtools-systemtap-parent</artifactId>
- <groupId>org.eclipse.linuxtools.systemtap</groupId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.linuxtools.threadprofiler.feature</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-feature</packaging>
-
- <name>Linux Tools Thread Profiler Feature</name>
-
-</project>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/.classpath b/systemtap/org.eclipse.linuxtools.threadprofiler/.classpath
deleted file mode 100644
index ad32c83a78..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/.gitignore b/systemtap/org.eclipse.linuxtools.threadprofiler/.gitignore
deleted file mode 100644
index 8d94ef8deb..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-bin
-@dot
-javaCompiler...args
-build.xml
-target
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/.project b/systemtap/org.eclipse.linuxtools.threadprofiler/.project
deleted file mode 100644
index e53b1e7971..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.linuxtools.threadprofiler</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/.settings/org.eclipse.jdt.core.prefs b/systemtap/org.eclipse.linuxtools.threadprofiler/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 1e7c741d58..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Thu Feb 11 14:47:42 EST 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/Axis.png b/systemtap/org.eclipse.linuxtools.threadprofiler/Axis.png
deleted file mode 100644
index 3f0fe585b3..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/Axis.png
+++ /dev/null
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.threadprofiler/META-INF/MANIFEST.MF
deleted file mode 100644
index 722f0f3fc3..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Threadprofiler
-Bundle-SymbolicName: org.eclipse.linuxtools.threadprofiler;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.linuxtools.internal.threadprofiler.ThreadProfilerPlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.cdt.core,
- org.eclipse.linuxtools.callgraph.launch,
- org.eclipse.linuxtools.callgraph.core,
- org.eclipse.debug.ui,
- org.eclipse.linuxtools.profiling.launch
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/ThreadProfile.stp b/systemtap/org.eclipse.linuxtools.threadprofiler/ThreadProfile.stp
deleted file mode 100644
index f66a1c4d5a..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/ThreadProfile.stp
+++ /dev/null
@@ -1,85 +0,0 @@
-#! /usr/bin/env stap
-
-# ------------------------------------------------------------------------
-# data collection
-
-# disk I/O stats
-probe begin { qnames["ioblock"] ++; qsq_start ("ioblock") }
-probe ioblock.request { if (pid && pid() == pid) { qs_wait ("ioblock") qs_run("ioblock") }}
-probe ioblock.end { if (pid && pid() == pid) { qs_done ("ioblock") }}
-
-# CPU utilization
-probe begin { qnames["cpu"] ++; qsq_start ("cpu") }
-probe scheduler.cpu_on { if (pid && pid() == pid) { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }}}
-probe scheduler.cpu_off { if (pid && pid() == pid) { if (!idle) qs_done ("cpu") }}
-
-
-# ------------------------------------------------------------------------
-# utilization history tracking
-
-global N, pid, threadstacks, threadcounters, reads, writes
-global qnames
-global counter
-probe begin {
- N = 50;
- pid = 0;
- reads = 0;
- writes = 0;
-}
-
-
-function qsq_util_reset(q) {
- u=qsq_utilization (q, 100)
- qsq_start (q)
- return u
-}
-
-
-probe process(@1).function("*").call {
- if (pid == 0) {
- pid = pid();
- }
- if (! threadcounters[tid()] ) {
- threadstacks[tid()] = probefunc();
- }
- threadcounters[tid()]++;
-}
-
-probe vfs.read.return {
- if (pid() == pid) {
- if ($return>0) {
- reads += $return;
- }
- }
-}
-
-probe vfs.write.return {
- if (pid() == pid) {
- if ($return>0) {
- writes += $return;
- }
- }
-}
-
-probe process(@1).function("*").return {
- threadcounters[tid()]--;
- if (! threadcounters[tid()]) {
- delete(threadcounters[tid()]);
- delete(threadstacks[tid()]);
- }
-}
-
-
-# ------------------------------------------------------------------------
-# general gnuplot graphical report generation
-
-probe timer.ms(50) {
- printf("--\n");
- printf("%d, %d, %d, %d, %d, %d, %d, %d\n", counter, qsq_util_reset("cpu"), qsq_util_reset("ioblock"), proc_mem_size_pid(pid) * mem_page_size(), proc_mem_data_pid(pid) * mem_page_size(), reads + writes, reads, writes);
- foreach (tid in threadcounters) {
- printf("%d:%s\n", tid, threadstacks[tid]);
- }
- reads = 0;
- writes = 0;
- counter++;
-} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/build.properties b/systemtap/org.eclipse.linuxtools.threadprofiler/build.properties
deleted file mode 100644
index 2f23ffa17e..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- ThreadProfile.stp
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/graphtest.stp b/systemtap/org.eclipse.linuxtools.threadprofiler/graphtest.stp
deleted file mode 100644
index 43e2e73ccf..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/graphtest.stp
+++ /dev/null
@@ -1,7 +0,0 @@
-global counter
-
-probe timer.s(1) {
- printf("%d, %d, %d", counter, counter*5, counter*10);
- counter++;
-
-} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/icons/pause.gif b/systemtap/org.eclipse.linuxtools.threadprofiler/icons/pause.gif
deleted file mode 100644
index d645fa5c3f..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/icons/pause.gif
+++ /dev/null
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/icons/perform.png b/systemtap/org.eclipse.linuxtools.threadprofiler/icons/perform.png
deleted file mode 100644
index 93e8f538f0..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/icons/perform.png
+++ /dev/null
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/plugin.xml b/systemtap/org.eclipse.linuxtools.threadprofiler/plugin.xml
deleted file mode 100644
index ae47ee69e0..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/plugin.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
- <extension
- point="org.eclipse.debug.ui.launchShortcuts">
- <shortcut
- class="org.eclipse.linuxtools.internal.threadprofiler.LaunchThreadProfiler"
- id="org.eclipse.linuxtools.systemtap.quicklaunchThreadProfiler"
- label="Thread Profiler"
- modes="profile">
- <contextualLaunch>
- <enablement>
- <with
- variable="selection">
- <count
- value="1">
- </count>
- <iterate>
- <or>
- <instanceof
- value="org.eclipse.cdt.core.model.IBinary">
- </instanceof>
- <instanceof
- value="org.eclipse.cdt.core.model.ICProject">
- </instanceof>
- <test
- forcePluginActivation="true"
- property="org.eclipse.cdt.launch.isExecutable">
- </test>
- <test
- forcePluginActivation="true"
- property="org.eclipse.cdt.launch.isCProject">
- </test>
- <and>
- <instanceof
- value="org.eclipse.ui.IFileEditorInput">
- </instanceof>
- <adapt
- type="org.eclipse.core.resources.IResource">
- <adapt
- type="org.eclipse.cdt.core.model.ICElement">
- </adapt>
- </adapt>
- </and>
- </or>
- </iterate>
- </with>
- </enablement>
- </contextualLaunch>
- </shortcut>
- </extension>
-
- <extension
- id="org.eclipse.linuxtools.threadprofiler.threadprofilerview"
- name="Thread Profiler View"
- point="org.eclipse.ui.views">
- <view
- category="org.eclipse.cdt.ui.views"
- class="org.eclipse.linuxtools.internal.threadprofiler.ThreadProfilerView"
- id="org.eclipse.linuxtools.threadprofiler.threadprofilerview"
- name="Thread Profiler View"
- restorable="true">
- </view>
- </extension>
-
- <extension
- id="org.eclipse.linuxtools.threadprofiler.threadparser"
- name="GraphParser"
- point="org.eclipse.linuxtools.callgraph.core.parser">
- <parser
- class="org.eclipse.linuxtools.internal.threadprofiler.ThreadProfilerParser"
- realtime="true">
- </parser>
- </extension>
-
-</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/pom.xml b/systemtap/org.eclipse.linuxtools.threadprofiler/pom.xml
deleted file mode 100644
index b070360235..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>linuxtools-systemtap-parent</artifactId>
- <groupId>org.eclipse.linuxtools.systemtap</groupId>
- <version>2.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.linuxtools.threadprofiler</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <name>Linux Tools Thread Profiler Plug-in</name>
-
-</project>
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/CircularPointBuffer.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/CircularPointBuffer.java
deleted file mode 100644
index a00919df86..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/CircularPointBuffer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-
-public class CircularPointBuffer {
-
- private DataPoint[] buffer;
- private int head, tail;
-
-
- /**
- * Create circular buffer with name 'Unknown'
- * @param size
- */
- public CircularPointBuffer(int size) {
- buffer = new DataPoint[size];
- head = 0;
- tail = 0;
- }
-
- public void add(DataPoint p) {
- buffer[tail] = p;
- tail++;
- if (tail >= buffer.length) {
- tail = 0;
- }
- if (tail == head) {
- head++;
- if (head >= buffer.length) {
- head = 0;
- }
- }
- }
-
- public Iterator<DataPoint> getIterator() {
- return new CircularIterator();
- }
-
- private class CircularIterator implements Iterator<DataPoint> {
- private int tempHead;
- private boolean finished;
-
- public CircularIterator() {
- tempHead = head;
- finished = false;
- }
-
- @Override
- public boolean hasNext() {
- return tempHead != tail;
- }
-
- @Override
- public DataPoint next() {
- if (finished)
- throw new NoSuchElementException();
-
- DataPoint p = buffer[tempHead];
- if (tempHead == tail)
- finished = true;
- else {
- tempHead++;
- if (tempHead == buffer.length)
- tempHead = 0;
- }
- return p;
- }
-
- @Override
- public void remove() {
- //Do nothing
- }
-
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/DataPoint.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/DataPoint.java
deleted file mode 100644
index d045c9e4e4..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/DataPoint.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-public class DataPoint {
- public static final int DATA_POINT = 0;
- public static final int AXIS_POINT = 1;
- public static final int PIXEL_POINT = 2;
-
- /** Inactive, do not draw this point */
- public static final int THREAD_INACTIVE = 0;
-
- /** Active, draw this point */
- public static final int THREAD_ACTIVE = 1;
-
-
- private int[] values;
-
- private int type;
-
- public DataPoint(int x, int y, int type) {
- values = new int[3];
- values[0] = x;
- values[1] = y;
- values[2] = 1;
- this.type = type;
- }
-
- public DataPoint(int[] values, int type) {
- this.values = values;
- this.type = type;
- }
-
- /**
- * Rounds to an integer
- * @return
- */
- public int getX() {
- return values[0];
- }
-
- public void setX(int x) {
- this.values[0] = x;
- }
-
- /**
- * Rounds to an integer
- * @return
- */
- public int getY() {
- return values[1];
- }
-
- public void setY(int y) {
- this.values[1] = y;
- }
-
- public int getType() {
- return type;
- }
-
- public int[] getValues() {
- return values;
- }
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphColorScheme.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphColorScheme.java
deleted file mode 100644
index 392ec1ba53..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphColorScheme.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * Represents a colour scheme. Should be made serializable and save-able.
- * @author chwang
- *
- */
-public class GraphColorScheme {
- private List<Color> graphColors;
- private Color axisColor;
- private Color fontColor;
- public final Color defaultColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
- public static final GraphColorScheme DEFAULT_SCHEME = new GraphColorScheme(
- new Color[] { new Color(Display.getDefault(), 255, 127, 80),
- new Color(Display.getDefault(), 138, 43, 226), new Color(Display.getDefault(), 184, 243, 80)},
- Display.getDefault().getSystemColor(SWT.COLOR_GRAY), Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
-
-
- public GraphColorScheme(Color[] graphColors, Color axisColor, Color fontColor) {
- this.graphColors = Arrays.asList(graphColors);
- this.axisColor = axisColor;
- this.fontColor = fontColor;
- }
-
- /**
- * @return
- * Array of colors to use for drawing graphs
- */
- public Iterator<Color> getIterator() {
- return graphColors.listIterator();
- }
-
- /**
- * @return
- * Array of colors to use for drawing graphs
- */
- public void setGraphColors(Color[] newColors) {
- this.graphColors = Arrays.asList(newColors);
- }
-
- /**
- * @return
- * Axis color to be used for axis lines
- */
- public Color getAxisColor() {
- return axisColor;
- }
-
- /**
- *
- * @return
- * Font color to be used for labels
- */
- public Color getFontColor() {
- return fontColor;
- }
-
- public void setAxisColor(Color c) {
- axisColor = c;
- }
-
- public void setFontColor(Color c) {
- fontColor = c;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphCoordinateSystem.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphCoordinateSystem.java
deleted file mode 100644
index b60c201add..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphCoordinateSystem.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-
-public class GraphCoordinateSystem {
-
-// TransformationMatrix dataToAxis; //TODO: Use later to scale data directly
- private TransformationMatrix axisToPixel;
- private String label;
-
- /**
- * Creates a coordinate system with its origin at the given x,y
- *
- * For graphs, (x,y) should correspond to the (0,0) point on the
- * graph axis.
- *
- * @param x
- * @param y
- */
- public GraphCoordinateSystem(int x, int y) {
-// double[][] dta = {{1.,0.,0},{0.,1.,0.}};
-// dataToAxis = new TransformationMatrix(dta);
-
- double[][] atp = {{1.,0.,0.},{0.,-1.,0.}};
- axisToPixel = new TransformationMatrix(atp);
- axisToPixel.setYShift(y);
- axisToPixel.setXShift(x);
- }
-
- public DataPoint dataToPixel(DataPoint point) {
- int[] values = point.getValues();
- return dataToPixel(values);
- }
-
- public DataPoint dataToPixel(int[] values) {
- if (values.length != 3)
- return null;
-
-// return new DataPoint(axisToPixel.times(dataToAxis.times(values)), 0);
- return new DataPoint(axisToPixel.times(values), 0);
- }
-
- public void scaleATPBy(double scale) {
- axisToPixel.scaleBy(scale);
- }
-
-// public void scaleDTABy(double scale) {
-// dataToAxis.scaleBy(scale);
-// }
-
-
- /**
- * d will automatically be inverted to properly display
- * @param d
- */
- public void setYScale(double d) {
- axisToPixel.setYScale(-1 * d);
- }
-
- public void setXScale(double d) {
- axisToPixel.setXScale(d);
- }
-
-
- public void setYOffset(int yCoordinate) {
- axisToPixel.setYShift(yCoordinate);
- }
-
- public void setXOffset(int xCoordinate) {
- axisToPixel.setXShift(xCoordinate);
- }
-
- public int getXOffset() {
- return axisToPixel.getXShift();
- }
-
- public int getYOffset() {
- return axisToPixel.getYShift();
- }
-
- public double getYScale() {
- return axisToPixel.getYScale();
- }
-
- public TransformationMatrix getAxisToPixel() {
- return axisToPixel;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public String getLabel() {
- return label;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphPointBuffer.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphPointBuffer.java
deleted file mode 100644
index 4fa7bc8980..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/GraphPointBuffer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-public class GraphPointBuffer extends CircularPointBuffer{
-
- private final int style;
- private final String name;
-
- public GraphPointBuffer(int size, int style, String name) {
- super(size);
- this.style = style;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public int getStyle() {
- return style;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/LaunchThreadProfiler.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/LaunchThreadProfiler.java
deleted file mode 100644
index 4f1da38904..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/LaunchThreadProfiler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.linuxtools.internal.callgraph.launch.SystemTapLaunchShortcut;
-
-public class LaunchThreadProfiler extends SystemTapLaunchShortcut{
-
- @Override
- public void launch(IBinary bin, String mode) {
- try {
- name = "Thread Profiler";
- ILaunchConfigurationWorkingCopy wc = createConfiguration(bin, name);
- outputPath = "/home/chwang/threadprofiler.output";
- binaryPath = bin.getResource().getLocation().toString();
- binaryPath = binaryPath.replaceAll("\\(", "\\\\\\(").replaceAll("\\)", "\\\\\\)").replaceAll(" ", "\\ ");
- arguments = binaryPath;
-
- finishLaunch(name, mode, wc);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public String setScriptPath() {
- return ThreadProfilerPlugin.getDefault().getPluginLocation() + "ThreadProfile.stp";
- }
-
- @Override
- public String setViewID() {
- return "org.eclipse.linuxtools.threadprofiler.threadprofilerview";
-
- }
-
- @Override
- public String setParserID() {
- return "org.eclipse.linuxtools.threadprofiler.threadparser";
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerParser.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerParser.java
deleted file mode 100644
index a7c8e72a16..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerParser.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.internal.callgraph.core.SystemTapParser;
-
-public class ThreadProfilerParser extends SystemTapParser {
-
- @Override
- protected void initialize() {
- }
-
- @Override
- public IStatus nonRealTimeParsing() {
- return realTimeParsing();
- }
- int counter = 0;
- @Override
- public IStatus realTimeParsing() {
- if (!(internalData instanceof BufferedReader))
- return Status.CANCEL_STATUS;
-
- if (!(view instanceof ThreadProfilerView))
- return Status.CANCEL_STATUS;
-
- BufferedReader buff = (BufferedReader) internalData;
-
- String line;
-
- try {
- while ((line = buff.readLine()) != null) {
- if (line.equals("--"))
- ((ThreadProfilerView) view).tick();
- if (line.contains(", ")) {
- String[] blargh = line.split(", ");
- ((ThreadProfilerView) view).addDataPoints(counter++, blargh);
- } else {
- String[] data = line.split(":");
- //TODO: Log error
- try {
- int tid = Integer.parseInt(data[0]);
- ((ThreadProfilerView) view).addThread(tid, data[1]);
- } catch (NumberFormatException e) {
- //Do nothing
- }
- }
- }
- view.update();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- return Status.OK_STATUS;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerPlugin.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerPlugin.java
deleted file mode 100644
index b3292c2fcd..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerPlugin.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ThreadProfilerPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.threadprofiler";
-
- // The shared instance
- private static ThreadProfilerPlugin plugin;
-
- /**
- * The constructor
- */
- public ThreadProfilerPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ThreadProfilerPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the location of the plugin by checking the path of the bundle's
- * locationURL.
- *
- * @return
- */
- public String getPluginLocation() {
- Bundle bundle = getBundle();
-
- URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
- URL fileUrl = null;
- try {
- fileUrl = FileLocator.toFileURL(locationUrl);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return fileUrl.getFile();
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerView.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerView.java
deleted file mode 100644
index 92afd54df2..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/ThreadProfilerView.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.linuxtools.internal.callgraph.core.SystemTapView;
-import org.eclipse.linuxtools.internal.threadprofiler.graphs.GraphModel;
-import org.eclipse.linuxtools.internal.threadprofiler.graphs.MultiGraph;
-import org.eclipse.linuxtools.internal.threadprofiler.graphs.ThreadGraph;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ScrollBar;
-
-public class ThreadProfilerView extends SystemTapView {
- private static final int CPU_BUFFER = 0;
- private static final int MEM_BUFFER = 1;
- private static final int DISK_BUFFER = 2;
- private static final String HIDE = "Hide";
- private static final String SHOW = "Show";
-// private static final int START_WIDTH = 350;
-// private static final int START_HEIGHT = 200;
- private static final int START_X_POS = 30;
- private static final int MAX_REFRESH_RATE = 100;
- private long lastRefresh = 0l;
- private ArrayList<GraphModel> graphs;
- private ArrayList<ThreadGraph> threads;
-
- private Canvas graphCanvas;
- private GC graphGC;
-// private Canvas threadCanvas;
- private final static int GRAPH_SEPARATION = 40;
- private final static int VBAR_INCREMENT = 10;
- private int segments;
- private int selector = 0;
- private IMenuManager dropMenu;
- private final SystemTapView currentView = this;
- private int oldHeight = 100;
- private static final Integer SHELL_ID_VALUE = new Integer(351);
- private static final String SHELL_ID_PROPERTY = "ThreadShellIDProperty";
- private int firstThread;
-
- private boolean pause = false;
- private ImageDescriptor playImage= ThreadProfilerPlugin.getImageDescriptor("icons/perform.png"); //$NON-NLS-1$
- private ImageDescriptor pauseImage= ThreadProfilerPlugin.getImageDescriptor("icons/pause.gif"); //$NON-NLS-1$
- private Action playPause = new Action("Pause", pauseImage) {
- @Override
- public void run() {
- pause = !pause;
- //Toggle image
- ImageDescriptor tmp = pause ? playImage : pauseImage;
- String txt = pause ? "Play" : "Pause";
- this.setImageDescriptor(tmp);
- this.setText(txt);
- }
- };
-
- /*
- * We have two frames of reference:
- *
- * 1. Pixel frame (absolute frame)
- * 2. Axis frame (relative frame)
- *
- * The transformation from 1 to 2 is a coordinate shift and scale
- *
- */
-
-
- @Override
- protected boolean createOpenAction() {
- return false;
- }
-
- @Override
- protected boolean createOpenDefaultAction() {
- return false;
- }
-
- @Override
- public IStatus initializeView(Display targetDisplay,
- IProgressMonitor monitor) {
- if (graphs == null)
- graphs = new ArrayList<GraphModel>();
- if (threads == null)
- threads = new ArrayList<ThreadGraph>();
- graphs.clear();
- threads.clear();
- segments = 0;
-
- //FIXME: these following lines do not work on Juno as they are referencing
- //an internal class that has changed from Indigo to Juno. Not sure what
- //this code is attempting. For now, commenting out.
-// IViewReference ref = getSite().getPage().
-// findViewReference("org.eclipse.linuxtools.threadprofiler.threadprofilerview");
-// ((WorkbenchPage)getSite().getPage()).getActivePerspective().
-// getPresentation().detachPart(ref);
-// currentView.getViewSite().getShell().setSize(START_WIDTH, START_HEIGHT);
-// currentView.getViewSite().getShell().setData(SHELL_ID_PROPERTY, SHELL_ID_VALUE);
-
-
- //Create dataSet for CPU
- createNewDataSet("CPU", GraphModel.CONSTANT_Y, "%");
- ((MultiGraph) graphs.get(0)).addBuffer("Total");
- ((MultiGraph) graphs.get(0)).addBuffer("IO Block");
-
- //Create dataSet for memory
- createNewDataSet("Memory", GraphModel.FLEXIBLE_Y, "bytes");
- ((MultiGraph) graphs.get(1)).addBuffer("Total");
- ((MultiGraph) graphs.get(1)).addBuffer("Data");
-
- //Create dataSet for disk usage
- createNewDataSet("Disk", GraphModel.FLEXIBLE_Y, "bytes");
- ((MultiGraph) graphs.get(2)).addBuffer("Total");
- ((MultiGraph) graphs.get(2)).addBuffer("Read", MultiGraph.GRAPH_STYLE_LINE);
- ((MultiGraph) graphs.get(2)).addBuffer("Write", MultiGraph.GRAPH_STYLE_LINE);
-
- if (dropMenu.getItems().length < graphs.size() + 1) {
- //the +1 is for the 'hide' item
- int counter = 0;
- for (GraphModel g : graphs) {
- final int count = counter;
- counter++;
- dropMenu.add(new Action(g.getTitle()) {
- @Override
- public void run(){
- selector = count;
- if (graphCanvas != null)
- graphCanvas.redraw();
- }
- });
- }
- final int count = counter;
- dropMenu.add(new Action("Threads") {
- @Override
- public void run() {
- selector = count;
- if (graphCanvas != null)
- graphCanvas.redraw();
- }
- });
- }
-
-
- return Status.OK_STATUS;
- }
-
- private void createNewDataSet(String name, int type, String units) {
- GraphModel graph = new MultiGraph(name, units, START_X_POS, 0, type);
- graphs.add(graph);
- }
-
- @Override
- public void setViewID() {
- viewID = "org.eclipse.linuxtools.threadprofiler.ThreadProfilerView";
- }
-
- @Override
- public void updateMethod() {
- if (graphCanvas != null && ! graphCanvas.isDisposed())
- graphCanvas.redraw();
-// threadCanvas.redraw();
- }
-
- @Override
- public void createPartControl(Composite parent) {
- if (masterComposite != null)
- masterComposite.dispose();
- masterComposite = parent;
-
- FillLayout gl = new FillLayout(SWT.NONE);
- parent.setLayout(gl);
-
- addMenus(parent);
-
- Canvas graphComp =new Canvas(parent, SWT.BORDER | SWT.V_SCROLL);
- graphComp.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
-
- final ScrollBar vBar = graphComp.getVerticalBar ();
- vBar.setIncrement(VBAR_INCREMENT);
- vBar.addListener (SWT.Selection, new Listener () {
- @Override
- public void handleEvent(Event event) {
-// int size = vBar.getMaximum();
-// int sel = vBar.getSelection() - vBar.getMinimum();
-// System.out.println("Sel: " + sel);
-// System.out.println("Size: " + size);
-// firstThread = (int) (sel/size * threads.size() + 0.5);
- firstThread = (vBar.getSelection() - vBar.getMinimum())/VBAR_INCREMENT;
- }
- });
-
- graphCanvas = graphComp;
-// graphCanvas.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
-// gd = new GridData(GridData.FILL_BOTH);
-// gd.grabExcessHorizontalSpace = true;
-// graphCanvas.setLayoutData(gd);
- graphGC = new GC(graphCanvas);
-
- graphCanvas.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseDoubleClick(MouseEvent e) {
- updateMethod();
- }
- });
-
- graphCanvas.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- long diff = System.currentTimeMillis() - lastRefresh;
- if (pause || (diff < MAX_REFRESH_RATE && diff > 0))
- try {
- Thread.sleep(diff);
- } catch (InterruptedException e1) {
- return;
- }
-
-
- Rectangle rect = graphCanvas.getBounds();
- Image buf = new Image(Display.getDefault(), graphCanvas.getBounds());
- GC gc = new GC(buf);
- gc.setClipping(rect);
- if (graphs != null && selector < graphs.size()) {
- //Double buffer!
- gc.setLineWidth(2);
- GraphModel graph = graphs.get(selector);
- graph.setHeight(rect.height - GraphModel.MAX_MARGIN - GraphModel.MAX_MARGIN/2);
- graph.setXOffset(rect.width/20);
- graph.setYOffset(rect.height - GraphModel.MAX_MARGIN);
- graph.draw(gc);
- graphGC.drawImage(buf, 0, 0);
- buf.dispose();
- } else if (threads != null) {
- if (threads == null)
- return;
- vBar.setMaximum(VBAR_INCREMENT*(threads.size() - 1));
- gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
-
- ArrayList<ThreadGraph> toRemove = new ArrayList<ThreadGraph>();
- int maxThreads = (int) (rect.height/GRAPH_SEPARATION + 0.5);
-
-// int counter = 0;
-// for (ThreadGraph tg : threads) {
-// counter++;
- if (firstThread >= threads.size() ) {
- firstThread = threads.size() - maxThreads;
- }
-
- if (firstThread < 0) {
- firstThread = 0;
- }
-
- for (int i = 0; i < maxThreads; i++) {
- if (i + firstThread >= threads.size())
- break;
- ThreadGraph tg = threads.get(i + firstThread);
- tg.setHeight(rect.height);
- tg.setYOffset(i*GRAPH_SEPARATION);
- gc.setLineWidth(2);
- tg.draw(gc);
- gc.setLineWidth(0);
- gc.drawText(tg.getTitle(), START_X_POS, i*GRAPH_SEPARATION + 10, true);
- if (tg.isEmpty())
- toRemove.add(tg);
- }
-// }
- //TODO: removeAll is an O(N^2) operation
- threads.removeAll(toRemove);
- graphGC.drawImage(buf, 0, 0);
- buf.dispose();
- System.out.println("-----------");
- }
- }
- });
-
-// ScrolledComposite threadComp =new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL);
-// threadComp.setLayout (new GridLayout(1, true));
-// threadComp.setBackground(white);
-// GridData gd = new GridData(GridData.FILL_BOTH);
-// gd.grabExcessHorizontalSpace = true;
-// threadComp.setLayoutData(gd);
-
-// threadCanvas = new Canvas(parent, SWT.BORDER );
-// threadCanvas.setBackground(white);
-// gd = new GridData(GridData.FILL_BOTH);
-// gd.grabExcessHorizontalSpace = true;
-// threadCanvas.setLayoutData(gd);
-// threadGC = new GC(threadCanvas);
-//
-// threadCanvas.addPaintListener(new PaintListener() {
-// @Override
-// public void paintControl(PaintEvent e) {
-//
-// }
-// });
-
- }
-
- private void addMenus(Composite parent) {
-
- Action hide = new Action(HIDE) {
- private void setHeight(int height) {
- Point size = currentView.getViewSite().getShell().getSize();
- Object o = currentView.getViewSite().getShell().getData(SHELL_ID_PROPERTY);
- if ( o instanceof Integer && ((Integer) o).equals(SHELL_ID_VALUE)) {
- oldHeight = size.y;
- currentView.getViewSite().getShell().setSize(size.x, height);
- }
- }
-
- @Override
- public void run() {
- if (this.getText().equals(HIDE)) {
- this.setText(SHOW);
- graphCanvas.setVisible(false);
- currentView.layout();
- setHeight(100);
- } else {
- this.setText(HIDE);
- graphCanvas.setVisible(true);
- currentView.layout();
- setHeight(oldHeight);
- }
- }
- };
-
-
- //Icon i.e. toolbar manager
- IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
-
- mgr.add(hide);
- mgr.add(playPause);
-
- //Dropdown manager
- dropMenu = getViewSite().getActionBars().getMenuManager();
- dropMenu.add(hide);
-
- }
-
- @Override
- public void setFocus() {
- //Do nothing
- }
-
-
-
- public void addDataPoints(int counter, String[] blargh) {
- if (segments < GraphModel.BUFFER_SIZE)
- segments++;
- if (blargh.length < 2)
- return;
- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[1]), 1), CPU_BUFFER, 0);
-
- if (blargh.length < 3)
- return;
- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[2]), 1), CPU_BUFFER, 1);
-
- if (blargh.length < 4)
- return;
- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[3]), 1), MEM_BUFFER, 0);
-
- if (blargh.length < 5)
- return;
- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[4]), 1), MEM_BUFFER, 1);
-
- if (blargh.length < 6)
- return;
- addPoint(new DataPoint(counter, Integer.parseInt(blargh[5]), 1), DISK_BUFFER, 0);
-
- if (blargh.length < 7)
- return;
- addPoint(new DataPoint(counter, Integer.parseInt(blargh[6]), 1), DISK_BUFFER, 1);
-
- if (blargh.length < 8)
- return;
- addPoint(new DataPoint(counter, Integer.parseInt(blargh[7]), 1), DISK_BUFFER, 2);
- }
-
-
- private void addPoint(DataPoint point, int dataSet, int subIndex) {
- if (graphs.size() < 1)
- return;
- graphs.get(dataSet).add(point, subIndex);
- }
-
- public void addThread(int tid, String line) {
- int i = threadExists(tid);
- if (i < 0) {
- ThreadGraph tg = new ThreadGraph(line, tid);
- tg.setXOffset(START_X_POS);
- for (int j = 0; j < segments; j++) {
- //Fill with empty segments
- tg.add(new DataPoint(0, 0, DataPoint.THREAD_INACTIVE), 0);
- }
- threads.add(tg);
- i = threads.size() - 1;
- }
- threads.get(i).addPoint();
- }
-
-
- public void tick() {
- // TODO Auto-generated method stub
- for (ThreadGraph tg : threads) {
- tg.tick();
- }
- }
-
- /**
- * Returns true if a thread with the given tid exists
- *
- * @param tid
- * @return
- */
- private int threadExists(int tid) {
- for (int i = 0; i < threads.size(); i++) {
- if (threads.get(i).getTid() == tid) {
- return i;
- }
- }
- return -1;
- }
-
-
-
- }
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/TransformationMatrix.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/TransformationMatrix.java
deleted file mode 100644
index 08cd0ec26f..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/TransformationMatrix.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler;
-
-/**
- * Basic transformation matrix. Only has support for scaling/shifting
- * @author chwang
- *
- */
-public class TransformationMatrix {
-
- public double[][] entries;
- public int columns, rows;
-
- public TransformationMatrix (double[][] values){
- columns = values[0].length;
- rows = values.length;
- entries = values;
- }
-
- public void setXScale(double scale) {
- entries[0][0] = scale;
- }
-
- public void setXShift(double shift) {
- entries[0][2] = shift;
- }
- public void setYScale(double scale) {
- entries[1][1] = scale;
- }
-
- public double getYScale() {
- return entries[1][1];
- }
-
- public void setYShift(double shift) {
- entries[1][2] = shift;
- }
-
- public void scaleBy(double scale) {
- entries[0][0] = entries[0][0]*scale;
- entries[1][1] = entries[1][1]*scale;
- }
-
- /**
- * Does simple matrix multiplication. Currently ignores any shearing effects.
- * Can change the amount of shifting by adjusting the third vector coordinate.
- * @param vector of coordinates to multiply
- * @return
- */
- public int[] times(int[] vector) {
- if (vector.length != 3)
- return null;
-
- int[] retval = new int[3];
- retval[0] = (int) ( vector[0]*entries[0][0] + vector[2]*entries[0][2]); //x transform
- retval[1] = (int) (vector[1]*entries[1][1] + vector[2]*entries[1][2]); //y transform
- retval[2] = 1; //Ghost coordinate
-
- return retval;
-
- }
-
- public int getXShift() {
- return (int) entries[0][2];
- }
-
- public int getYShift() {
- return (int) entries[1][2];
- }
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/GraphModel.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/GraphModel.java
deleted file mode 100644
index fbbfa92a1f..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/GraphModel.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler.graphs;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.linuxtools.internal.threadprofiler.CircularPointBuffer;
-import org.eclipse.linuxtools.internal.threadprofiler.DataPoint;
-import org.eclipse.linuxtools.internal.threadprofiler.GraphColorScheme;
-import org.eclipse.linuxtools.internal.threadprofiler.GraphCoordinateSystem;
-import org.eclipse.swt.graphics.GC;
-
-public abstract class GraphModel {
-
- //Constant Y scale
- public static final int CONSTANT_Y = 0;
- //Change Y scale as the maximum y point increases
- public static final int FLEXIBLE_Y = 1;
- /** Maximum buffer size. This affects the number of data points*/
- public static final int BUFFER_SIZE = 300;
- //Default height
- public static final int DEFAULT_HEIGHT = 100;
- /** Minimum separation between any two graduations on the axis */
- public static final int MIN_SEPARATION = 10;
-
- /** Max pixel size of the margins */
- public static final int MAX_MARGIN = 30;
- /** Min pixel size of the margins */
- public static final int MIN_MARGIN = 10;
-
- private final GraphCoordinateSystem coordinates;
- private final int flexible;
- private final String title;
- private final String units;
- private boolean changed;
- protected final ArrayList<CircularPointBuffer> data;
- protected GraphColorScheme colorScheme = GraphColorScheme.DEFAULT_SCHEME;
-
- private int height;
-
- private int maxY;
- //Height in pixels
-
-
- /**
- * Creates a new graph model
- *
- *
- */
- public GraphModel(String name, String units, int x, int y, int flex) {
- title = name;
- this.units = units;
- changed = false;
- coordinates = new GraphCoordinateSystem(x, y);
- coordinates.setYScale(0.2);
- coordinates.setLabel(DEFAULT_HEIGHT + units);
- flexible = flex;
-
- data = new ArrayList<CircularPointBuffer>();
- height = DEFAULT_HEIGHT;
- maxY = 100;
- }
-
-
- public void setMaxY(int max) {
- maxY = max;
- }
-
- public int getXOffset() {
- return (int) coordinates.getAxisToPixel().entries[0][2];
- }
-
- public int getYOffset() {
- return (int) coordinates.getAxisToPixel().entries[1][2];
- }
-
-
- /**
- *
- * @return
- * First available point buffer if any is available, else null
- */
- public Iterator<DataPoint> getPointBuffer() {
- if (data.size() > 1)
- return getPointBuffer(0);
- return null;
- }
-
- public Iterator<DataPoint> getPointBuffer(int index) {
- return data.get(index).getIterator();
- }
-
- public void add(DataPoint point, int subIndex) {
- if (subIndex == data.size()) {
- data.add(new CircularPointBuffer(BUFFER_SIZE));
- } else if (subIndex > data.size()) {
- //Do not create pointless buffers
- return;
- }
- if (flexible == FLEXIBLE_Y) {
- if (point.getY() > maxY ) {
- maxY = point.getY();
- coordinates.setLabel(maxY + " " + units);
- if ( point.getY() > height) {
- double newScale = (double) height/maxY;
- coordinates.setYScale(newScale);
- }
- }
- }
- data.get(subIndex).add(point);
- setChanged(true);
- }
-
- public DataPoint transform(DataPoint toTransform) {
- return coordinates.dataToPixel(toTransform);
- }
-
- public DataPoint transform(int x, int y, int z) {
- return coordinates.dataToPixel(new int[] {x, y, z});
- }
-
- public boolean isChanged() {
- return changed;
- }
-
- public void setChanged(boolean val) {
- changed = val;
- }
-
- public String getTitle() {
- return title;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int value) {
- if (height == value)
- return;
- height = value;
- double newScale = (double) height/maxY;
- coordinates.setYScale(newScale);
- }
-
- public void setXScale(double value) {
- coordinates.setXScale(value);
- }
-
-
- /**
- * Set offset -- has minimum value of MIN_SEPARATION
- * @param value
- */
- public void setYOffset(int value) {
- if (value < MIN_MARGIN)
- value = MIN_MARGIN;
- else if (value > getHeight() + MAX_MARGIN/2)
- value = getHeight() + MAX_MARGIN/2;
- coordinates.setYOffset(value);
- }
-
- /**
- * Set offset -- has minimum value of MIN_SEPARATION
- * @param value
- */
- public void setXOffset(int value) {
- if (value < MIN_MARGIN)
- value = MIN_MARGIN;
- else if (value > MAX_MARGIN)
- value = MAX_MARGIN;
- coordinates.setXOffset(value);
- }
-
-
- public GraphCoordinateSystem getCoordinates() {
- return coordinates;
- }
-
- /**
- * The main draw function -- implement this method to change
- * the way things are graphed
- *
- * @param gc
- * @param graphCanvas
- */
- public abstract void draw(GC gc);
-
-
- protected void drawLine(GC gc, DataPoint p1, DataPoint p2) {
- gc.drawLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
- }
-
- /**
- *
- * @return
- * Number of data buffers in this model
- */
- public int getBufferCount() {
- return data.size();
- }
-
- /**
- * Draws the x-axis and sets up the graph's title.
- * Also draws graduations for the x-axis
- *
- * @param gc
- * @param width
- */
- protected void drawAxis(GC gc) {
- gc.setForeground(colorScheme.getFontColor());
- gc.drawText(getTitle(), getXOffset(), getYOffset() + 5, true);
-
- double xSeg = getXOffset();
- double increment = getXIncrement(gc);
- if (increment < MIN_SEPARATION)
- increment = MIN_SEPARATION;
-
-
- double endX = gc.getClipping().width - getXOffset();
-
- gc.setAlpha(255);
- gc.setLineWidth(2);
- gc.setForeground(colorScheme.getAxisColor());
- while (xSeg < endX) {
- gc.drawLine(round(xSeg), getYOffset(), round(xSeg), getYOffset() - getHeight());
- xSeg += increment;
- }
- gc.drawLine(getXOffset(), getYOffset(), round(xSeg), getYOffset());
- }
-
- protected double getXIncrement(GC gc) {
- double incr = (gc.getClipping().width - (double)2*getXOffset())/BUFFER_SIZE;
- if ( incr <= 0 )
- incr = 1;
- return incr;
- }
-
- protected double getYScale() {
- return coordinates.getYScale();
- }
-
- protected int round(double value) {
- return (value > 0.5) ? (int) value + 1 : (int) value;
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/MultiGraph.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/MultiGraph.java
deleted file mode 100644
index 0a73a7e3be..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/MultiGraph.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler.graphs;
-
-import java.util.Iterator;
-
-import org.eclipse.linuxtools.internal.threadprofiler.CircularPointBuffer;
-import org.eclipse.linuxtools.internal.threadprofiler.DataPoint;
-import org.eclipse.linuxtools.internal.threadprofiler.GraphPointBuffer;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-
-public class MultiGraph extends GraphModel {
-
- /** Width of lines/squares for legend symbols */
- private static final int LEGEND_WIDTH = 10;
- /** Extra space to leave between legend entries */
- private static final int LEGEND_SEPARATION = LEGEND_WIDTH*2;
- /** 1.5 times LEGEND_WIDTH */
- private static final int LEGEND_WIDTH_AND_HALF = LEGEND_WIDTH + LEGEND_WIDTH/2;
-
- public static final int GRAPH_STYLE_FILL = 0;
- public static final int GRAPH_STYLE_LINE = 1;
- private int defaultStyle = GRAPH_STYLE_FILL;
- private int bufferSize = BUFFER_SIZE;
-
- public MultiGraph(String name, String units, int x, int y, int type) {
- super(name, units, x, y, type);
- }
-
- public void setDefaultStyle(int style) {
- defaultStyle = style;
- }
-
- public void setDefaultSize(int size) {
- bufferSize= size;
- }
-
- @Override
- public void draw(GC gc) {
- Color color = colorScheme.defaultColor;
- Iterator<Color> it = colorScheme.getIterator();
-
- for (CircularPointBuffer b : data) {
- if (! (b instanceof GraphPointBuffer)) {
- continue;
- }
- if (it.hasNext())
- color = it.next();
- gc.setLineWidth(2);
- GraphPointBuffer buf = (GraphPointBuffer) b;
-
- switch (buf.getStyle()) {
- case GRAPH_STYLE_LINE :
- gc.setForeground(color);
- drawLineGraph(gc, buf.getIterator());
- break;
- case GRAPH_STYLE_FILL :
- gc.setBackground(color);
- drawFillPolygonGraph(gc, buf.getIterator());
- break;
- default :
- break;
- }
- }
- drawAxis(gc);
- drawLegend(gc);
- }
-
- private void drawLegend(GC gc) {
- int x = getXOffset() + gc.getFontMetrics().getAverageCharWidth() * getTitle().length() + LEGEND_SEPARATION + LEGEND_WIDTH_AND_HALF;
-
- Color color = colorScheme.defaultColor;
- Iterator<Color> it = colorScheme.getIterator();
-
- for (CircularPointBuffer b : data) {
- if (! (b instanceof GraphPointBuffer)) {
- continue;
- }
- if (it.hasNext())
- color = it.next();
- GraphPointBuffer buf = (GraphPointBuffer) b;
-
- switch(buf.getStyle()) {
- case GRAPH_STYLE_LINE :
- gc.setLineWidth(2);
- gc.setForeground(color);
- gc.drawLine(x, getYOffset() + LEGEND_WIDTH_AND_HALF, x + LEGEND_WIDTH, getYOffset() + LEGEND_WIDTH_AND_HALF);
- break;
- case GRAPH_STYLE_FILL :
- gc.setBackground(color);
- gc.fillRectangle(x, getYOffset() + LEGEND_WIDTH, LEGEND_WIDTH, LEGEND_WIDTH);
- break;
- default :
- break;
- }
-
- gc.setForeground(colorScheme.getFontColor());
- gc.drawText(buf.getName(), x + LEGEND_WIDTH_AND_HALF, getYOffset() + LEGEND_WIDTH/2, true);
-
- x += gc.getFontMetrics().getAverageCharWidth() * buf.getName().length() + LEGEND_SEPARATION + LEGEND_WIDTH_AND_HALF;
- }
-
- }
-
- public void addBuffer(String name) {
- addBuffer(bufferSize, name, defaultStyle);
- }
-
- public void addBuffer(int bufferSize, String name) {
- addBuffer(bufferSize, name, defaultStyle);
- }
-
- public void addBuffer(String name, int graphStyle) {
- addBuffer(bufferSize, name, graphStyle);
- }
-
- public void addBuffer(int bufferSize, String name, int graphStyle) {
- data.add(new GraphPointBuffer(bufferSize, graphStyle, name));
- }
-
- protected void drawFillPolygonGraph(GC gc, Iterator<DataPoint> nextPointBuffer) {
- DataPoint pp = new DataPoint(getXOffset(), getYOffset(), 0);
- double xSeg = this.getXOffset();
- double increment = getXIncrement(gc);
- while (nextPointBuffer.hasNext()) {
- gc.setAlpha(170);
- DataPoint nextPoint = new DataPoint((int) (xSeg + 0.5), this.transform(nextPointBuffer.next()).getY(), 0);
- //Use old point, new point, and the corresponding intersections with the x-axis to fill
- gc.fillPolygon(new int[] {pp.getX(), pp.getY(), nextPoint.getX(), nextPoint.getY(), nextPoint.getX(), getYOffset(), pp.getX(), getYOffset()});
- xSeg += increment;
- pp = nextPoint;
- }
- }
-
- protected void drawLineGraph(GC gc, Iterator<DataPoint> nextPointBuffer) {
- DataPoint pp = new DataPoint(getXOffset(), getYOffset(), 0);
- double xSeg = this.getXOffset();
- double increment = getXIncrement(gc);
-
- while (nextPointBuffer.hasNext()) {
- DataPoint nextPoint = new DataPoint((int) (xSeg + 0.5), this.transform(nextPointBuffer.next()).getY(), 0);
- xSeg += increment;
- drawLine(gc, pp, nextPoint);
- pp = nextPoint;
- }
- }
-
-}
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/ThreadGraph.java b/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/ThreadGraph.java
deleted file mode 100644
index 1985d481d5..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/src/org/eclipse/linuxtools/internal/threadprofiler/graphs/ThreadGraph.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2013 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat - initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.internal.threadprofiler.graphs;
-
-import java.util.Iterator;
-
-import org.eclipse.linuxtools.internal.threadprofiler.DataPoint;
-import org.eclipse.swt.graphics.GC;
-
-public class ThreadGraph extends GraphModel{
-
- private int tid;
- private DataPoint dp;
- private boolean empty;
-
- public ThreadGraph(String name, int tid) {
- super(name, "", 0, 0, 0);
- this.tid = tid;
- empty = false;
- }
-
- public ThreadGraph(String name, String units, int x, int y, int type, int tid) {
- super(name, units, x, y, type);
- this.tid = tid;
- empty = false;
- }
-
- public int getTid() {
- return tid;
- }
-
- /**
- * Returns true if this graph has data points and they are all empty
- *
- * @return
- */
- public boolean isEmpty() {
- return empty;
- }
-
- @Override
- public void draw(GC gc) {
- double increment = getXIncrement(gc);
-
- //Each thread should only have one buffer
- Iterator<DataPoint> buffer = data.get(0).getIterator();
- double xPos = this.getXOffset();
- empty = true;
- if (!buffer.hasNext())
- empty = false;
- double temp = 0;
- while (buffer.hasNext()) {
- DataPoint p = buffer.next();
- if (p.getType() == DataPoint.THREAD_ACTIVE) {
- temp += increment;
- empty = false;
- } else {
- if (temp != 0) {
- gc.drawLine((int) (xPos + 0.5), getYOffset(), (int) (xPos + temp + 0.5), getYOffset());
- xPos += temp;
- temp = 0;
- } else {
- xPos += increment;
- }
- }
- }
- gc.drawLine((int) (xPos + 0.5), getYOffset(), (int) (xPos + temp + 0.5), getYOffset());
- }
-
- public void addPoint() {
- dp = new DataPoint(0, 0, DataPoint.THREAD_ACTIVE);
- }
-
- public void tick() {
- //TODO: This method of updating requires passing around a bulky datapoint variable
- if (dp != null)
- add(dp, 0);
- else {
- add(new DataPoint(0, 0, DataPoint.THREAD_INACTIVE), 0);
- }
- dp = null;
- }
-
- } \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.threadprofiler/threadprofiler.patch b/systemtap/org.eclipse.linuxtools.threadprofiler/threadprofiler.patch
deleted file mode 100644
index 3eb91f043b..0000000000
--- a/systemtap/org.eclipse.linuxtools.threadprofiler/threadprofiler.patch
+++ /dev/null
@@ -1,1237 +0,0 @@
-diff --git a/ThreadProfile.stp b/ThreadProfile.stp
-index 4d7fe50..daab497 100644
---- a/ThreadProfile.stp
-+++ b/ThreadProfile.stp
-@@ -39,31 +39,30 @@ probe process(@1).function("*").call {
- setup();
- pid = pid();
- }
-+ if (! threadcounters[tid()] ) {
-+ threadstacks[tid()] = probefunc();
-+ }
- threadcounters[tid()]++;
-- threadstacks[tid(),threadcounters[tid()]] = probefunc();
- }
-
- probe process(@1).function("*").return {
-- delete(threadstacks[tid(),threadcounters[tid()]]);
-- if (threadcounters[tid()] == 1) {
-+ threadcounters[tid()]--;
-+ if (! threadcounters[tid()]) {
- delete(threadcounters[tid()]);
-- delete(threadstacks[tid(),0]);
-+ delete(threadstacks[tid()]);
- }
-- else
-- threadcounters[tid()]--;
- }
-
-
- # ------------------------------------------------------------------------
- # general gnuplot graphical report generation
-
--probe timer.ms(500) {
-+probe timer.ms(100) {
- printf("--\n");
- printf("%d, %d, %d, %d, %d, %d, %d, %d\n", counter, qsq_util_reset("cpu"), qsq_util_reset("ioblock"), proc_mem_size() * mem_page_size(), proc_mem_data() * mem_page_size(), reads + writes, reads, writes);
- foreach (tid in threadcounters) {
-- printf("%d:%s\n", tid, threadstacks[tid, 1]);
-+ printf("%d:%s\n", tid, threadstacks[tid]);
- }
-- printf("--\n");
- reads = 0;
- writes = 0;
- counter++;
-diff --git a/bin/org/eclipse/linuxtools/threadprofiler/DataPoint.class b/bin/org/eclipse/linuxtools/threadprofiler/DataPoint.class
-index a620579..9f26a69 100644
-Binary files a/bin/org/eclipse/linuxtools/threadprofiler/DataPoint.class and b/bin/org/eclipse/linuxtools/threadprofiler/DataPoint.class differ
-diff --git a/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.class b/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.class
-index 2876d9d..a35972d 100644
-Binary files a/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.class and b/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.class differ
-diff --git a/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.class b/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.class
-index 2015b3b..924310a 100644
-Binary files a/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.class and b/bin/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.class differ
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/DataPoint.java b/src/org/eclipse/linuxtools/threadprofiler/DataPoint.java
-index 8deb632..cac1b2d 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/DataPoint.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/DataPoint.java
-@@ -1,10 +1,22 @@
- package org.eclipse.linuxtools.internal.threadprofiler;
-
- public class DataPoint {
-+
-+ /** Indicates that this is a raw data point */
- public static final int DATA_POINT = 0;
-+
-+ /** Indicates that this is a point relative to the axis */
- public static final int AXIS_POINT = 1;
-+
-+ /** Indicates that this is an absolute pixel point */
- public static final int PIXEL_POINT = 2;
-
-+ /** Inactive, do not draw this point */
-+ public static final int INACTIVE = 0;
-+
-+ /** Active, draw this point */
-+ public static final int ACTIVE = 1;
-+
- private int[] values;
-
- private int type;
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/ThreadGraph.java b/src/org/eclipse/linuxtools/threadprofiler/ThreadGraph.java
-index 9cc6ec7..f6c5dec 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/ThreadGraph.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/ThreadGraph.java
-@@ -1,21 +1,74 @@
- package org.eclipse.linuxtools.internal.threadprofiler;
-
--public class ThreadGraph {
--
-- private final String name;
-- private final int tid;
-+import java.util.Iterator;
-+
-+import org.eclipse.linuxtools.internal.threadprofiler.graphs.GraphModel;
-+import org.eclipse.swt.graphics.GC;
-+import org.eclipse.swt.widgets.Composite;
-+
-+public class ThreadGraph extends GraphModel{
-+
-+ private int tid;
-+ private DataPoint dp;
-+ private boolean empty;
-
-- public ThreadGraph(int tid, String name) {
-- this.name = name;
-+ public ThreadGraph(String name, int x, int y, int type, String units, int tid) {
-+ super(name, x, y, type, units);
- this.tid = tid;
-+ empty = false;
- }
-
- public int getTid() {
- return tid;
- }
-
-- public String getName() {
-- return name;
-+ private void setEmpty(boolean val) {
-+ empty = val;
-+ }
-+
-+ /**
-+ * Returns true if this graph has data points and they are all empty
-+ *
-+ * @return
-+ */
-+ public boolean isEmpty() {
-+ return empty;
-+ }
-+
-+ @Override
-+ public void drawOn(GC gc, Composite graphCanvas) {
-+ int increment = (graphCanvas.getSize().x - this.getXOffset())/GraphModel.BUFFER_SIZE;
-+
-+ //Each thread should only have one buffer
-+ Iterator<DataPoint> buffer = data.get(0).getIterator();
-+ int xPos = this.getXOffset();
-+ boolean em = true;
-+ if (!buffer.hasNext())
-+ em = false;
-+ while (buffer.hasNext()) {
-+ DataPoint p = buffer.next();
-+ if (p.getType() == DataPoint.ACTIVE) {
-+ em = false;
-+ gc.drawLine(xPos, getYOffset(), xPos + increment, getYOffset());
-+ }
-+ xPos += increment;
-+ }
-+
-+ setEmpty(em);
-+ }
-+
-+ public void prep(DataPoint dataPoint, int i) {
-+ dp = dataPoint;
-+ }
-+
-+ public void tick() {
-+ //TODO: This method if updating requires passing around a bulky datapoint variable
-+ if (dp != null)
-+ add(dp, 0);
-+ else {
-+ add(new DataPoint(0, 0, DataPoint.INACTIVE), 0);
-+ }
-+ dp = null;
- }
-
- }
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.java b/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.java
-index d9dac71..6fcd306 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerParser.java
-@@ -33,21 +33,20 @@ public class ThreadProfilerParser extends SystemTapParser {
- boolean changed = false;
- try {
- while ((line = buff.readLine()) != null) {
-- System.out.println("Parsed: " + line);
-+// System.out.println("Parsed: " + line);
- changed = true;
-- if (line.equals("--"))
-+ if (line.equals("--")) {
-+ ((ThreadProfilerView) view).closeThreads();
- continue;
-+ }
- if (line.contains(", ")) {
- String[] blargh = line.split(", ");
-- ((ThreadProfilerView) view).addNextCPUPoint(counter, blargh);
-- ((ThreadProfilerView) view).addNextMemoryPoint(counter++, blargh);
-- ((ThreadProfilerView) view).addNextDiskPoint(counter++, blargh);
-+ ((ThreadProfilerView) view).addDataPoints(counter++, blargh);
- } else {
- String[] data = line.split(":");
- int tid = Integer.parseInt(data[0]);
- ((ThreadProfilerView) view).addThread(tid, data[1]);
- }
--
- }
- if (changed) view.update();
- } catch (NumberFormatException e) {
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.java b/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.java
-index 2dbaaf7..40b7460 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/ThreadProfilerView.java
-@@ -1,265 +1,297 @@
--package org.eclipse.linuxtools.internal.threadprofiler;
--
--import java.util.ArrayList;
--
--import org.eclipse.core.runtime.IProgressMonitor;
--import org.eclipse.core.runtime.IStatus;
--import org.eclipse.core.runtime.Status;
--import org.eclipse.linuxtools.callgraph.core.SystemTapView;
--import org.eclipse.linuxtools.internal.threadprofiler.graphs.GraphModel;
--import org.eclipse.linuxtools.internal.threadprofiler.graphs.MultiGraph;
--import org.eclipse.swt.SWT;
--import org.eclipse.swt.custom.ScrolledComposite;
--import org.eclipse.swt.events.MouseEvent;
--import org.eclipse.swt.events.MouseListener;
--import org.eclipse.swt.events.PaintEvent;
--import org.eclipse.swt.events.PaintListener;
--import org.eclipse.swt.graphics.Color;
--import org.eclipse.swt.graphics.GC;
--import org.eclipse.swt.layout.GridData;
--import org.eclipse.swt.layout.GridLayout;
--import org.eclipse.swt.widgets.Button;
--import org.eclipse.swt.widgets.Canvas;
--import org.eclipse.swt.widgets.Composite;
--import org.eclipse.swt.widgets.Display;
--
--public class ThreadProfilerView extends SystemTapView {
-- private static final int CPU_BUFFER = 0;
-- private static final int MEM_BUFFER = 1;
-- private static final int DISK_BUFFER = 2;
-- private ArrayList<GraphModel> graphs;
-- private ArrayList<ThreadGraph> threads;
--
-- private Composite graphCanvas;
-- private Canvas threadCanvas;
-- private final long REFRESH_TIME_MS = 700;
-- private final static int GRAPH_SEPARATION = 40;
-- private long time;
-- private int segments;
--
-- /*
-- * We have two frames of reference:
-- *
-- * 1. Pixel frame (absolute frame)
-- * 2. Axis frame (relative frame)
-- *
-- * The transformation from 1 to 2 is a coordinate shift and scale
-- *
-- */
--
--
-- @Override
-- protected boolean createOpenAction() {
-- return false;
-- }
--
-- @Override
-- protected boolean createOpenDefaultAction() {
-- return false;
-- }
--
-- @Override
-- public IStatus initializeView(Display targetDisplay,
-- IProgressMonitor monitor) {
-- if (graphs == null)
-- graphs = new ArrayList<GraphModel>();
-- if (threads == null)
-- threads = new ArrayList<ThreadGraph>();
-- graphs.clear();
-- threads.clear();
-- segments = 0;
--
-- //Create dataSet for CPU
-- createNewDataSet("CPU", GraphModel.CONSTANT_Y, "%");
-- ((MultiGraph) graphs.get(0)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-- ((MultiGraph) graphs.get(0)).addBuffer(GraphModel.BUFFER_SIZE, "IO Block");
--
-- //Create dataSet for memory
-- createNewDataSet("Memory", GraphModel.FLEXIBLE_Y, "bytes");
-- ((MultiGraph) graphs.get(1)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-- ((MultiGraph) graphs.get(1)).addBuffer(GraphModel.BUFFER_SIZE, "Data");
--
-- //Create dataSet for disk usage
-- createNewDataSet("Disk", GraphModel.FLEXIBLE_Y, "bytes");
-- ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-- ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Read");
-- ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Write");
-- ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_FILL);
-- ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_LINE);
-- ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_LINE);
--
-- time = System.currentTimeMillis();
--
-- graphCanvas.addMouseListener(new MouseListener() {
--
-- @Override
-- public void mouseDoubleClick(MouseEvent e) {
-- updateMethod();
-- }
--
-- @Override
-- public void mouseDown(MouseEvent e) {
-- System.out.println("LOCATION: " + e.x + "," + e.y);
-- }
--
-- @Override
-- public void mouseUp(MouseEvent e) {
-- // TODO Auto-generated method stub
--
-- }
--
-- });
--
-- graphCanvas.addPaintListener(new PaintListener() {
-- public void paintControl(PaintEvent e) {
--// if (!graphs.get(0).isChanged())
--// return;
--
--
-- for (int i = 0; i < graphs.size(); i ++) {
-- GraphModel graph = graphs.get(i);
-- GC gc = new GC(graphCanvas);
-- gc.setLineWidth(2);
-- graph.setHeight((int) (graphCanvas.getSize().y/(2.5*graphs.size())));
-- graph.setYAxisCoordinate((graph.getHeight() + GRAPH_SEPARATION) *(i + 1));
-- graph.drawOn(gc, graphCanvas);
-- gc.dispose();
-- }
-- }
-- });
--
--
-- threadCanvas.addPaintListener(new PaintListener() {
--
-- @Override
-- public void paintControl(PaintEvent e) {
-- if (threads == null)
-- return;
-- int yOffset = 40;
--
-- GC gc = new GC(threadCanvas);
-- gc.setLineWidth(4);
-- gc.setForeground(new Color(Display.getCurrent(), 0, 0, 200));
-- int increment = (graphCanvas.getSize().x - 40)/GraphModel.BUFFER_SIZE;
--
-- for (ThreadGraph tg : threads) {
-- gc.drawText(tg.getName(), 40, yOffset);
-- gc.drawLine(40, yOffset, 40 + increment*segments, yOffset);
-- }
-- }
--
-- });
--
-- return Status.OK_STATUS;
-- }
--
-- private void createNewDataSet(String name, int type, String units) {
-- GraphModel graph = new MultiGraph(name, 50, (GraphModel.DEFAULT_HEIGHT + GRAPH_SEPARATION) *(graphs.size() + 1), type, units);
-- graphs.add(graph);
-- }
--
-- @Override
-- public void setViewID() {
-- viewID = "org.eclipse.linuxtools.internal.threadprofiler.ThreadProfilerView";
-- }
--
-- @Override
-- public void updateMethod() {
-- if (System.currentTimeMillis() - time < REFRESH_TIME_MS)
-- return;
-- time = System.currentTimeMillis();
-- graphCanvas.redraw();
-- }
--
-- @Override
-- public void createPartControl(Composite parent) {
-- GridLayout gl = new GridLayout(1, true);
-- parent.setLayout(gl);
-- Color white = new Color(Display.getCurrent(), 255, 255, 255);
--
-- graphCanvas = new Composite(parent, SWT.BORDER);
-- graphCanvas.setBackground(white);
-- GridData gd = new GridData(GridData.FILL_BOTH);
-- gd.grabExcessHorizontalSpace = true;
-- graphCanvas.setLayoutData(gd);
--
-- threadCanvas = new Canvas(parent, SWT.BORDER);
-- threadCanvas.setBackground(white);
-- gd = new GridData(GridData.FILL_BOTH);
-- gd.grabExcessHorizontalSpace = true;
-- threadCanvas.setLayoutData(gd);
-- }
--
-- @Override
-- public void setFocus() {
-- //Do nothing
-- }
--
--
-- public void addNextCPUPoint(int counter, String[] blargh) {
-- if (blargh.length < 2)
-- return;
-- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[1]), 1), CPU_BUFFER, 0);
--
-- if (blargh.length < 3)
-- return;
-- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[2]), 1), CPU_BUFFER, 1);
-- }
--
-- public void addNextMemoryPoint(int counter, String[] blargh) {
-- if (blargh.length < 4)
-- return;
-- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[3]), 1), MEM_BUFFER, 0);
-- if (blargh.length < 5)
-- return;
-- this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[4]), 1), MEM_BUFFER, 1);
-- }
--
-- public void addNextDiskPoint(int counter, String[] blargh) {
-- if (blargh.length < 6)
-- return;
-- addPoint(new DataPoint(counter, Integer.parseInt(blargh[5]), 1), DISK_BUFFER, 0);
--
-- if (blargh.length < 7)
-- return;
-- addPoint(new DataPoint(counter, Integer.parseInt(blargh[6]), 1), DISK_BUFFER, 1);
--
-- if (blargh.length < 8)
-- return;
-- addPoint(new DataPoint(counter, Integer.parseInt(blargh[7]), 1), DISK_BUFFER, 2);
-- }
--
-- private void addPoint(DataPoint point, int dataSet, int subIndex) {
-- if (graphs.size() < 1)
-- return;
-- if (segments < GraphModel.BUFFER_SIZE)
-- segments++;
-- graphs.get(dataSet).add(point, subIndex);
-- }
--
-- public void addThread(int tid, String line) {
-- if (!threadExists(tid)) {
-- ThreadGraph tg = new ThreadGraph(tid, line);
-- threads.add(tg);
-- }
-- }
--
-- /**
-- * Returns true if a thread with the given tid exists
-- *
-- * @param tid
-- * @return
-- */
-- private boolean threadExists(int tid) {
-- boolean exists = false;
-- for (ThreadGraph g : threads) {
-- if (g.getTid() == tid) {
-- exists = true;
-- break;
-- }
-- }
-- return exists;
-- }
--
--
-+package org.eclipse.linuxtools.internal.threadprofiler;
-+
-+import java.util.ArrayList;
-+
-+import org.eclipse.core.resources.IContainer;
-+import org.eclipse.core.runtime.IProgressMonitor;
-+import org.eclipse.core.runtime.IStatus;
-+import org.eclipse.core.runtime.Status;
-+import org.eclipse.linuxtools.callgraph.core.SystemTapView;
-+import org.eclipse.linuxtools.internal.threadprofiler.graphs.GraphModel;
-+import org.eclipse.linuxtools.internal.threadprofiler.graphs.MultiGraph;
-+import org.eclipse.swt.SWT;
-+import org.eclipse.swt.custom.ScrolledComposite;
-+import org.eclipse.swt.events.MouseEvent;
-+import org.eclipse.swt.events.MouseListener;
-+import org.eclipse.swt.events.PaintEvent;
-+import org.eclipse.swt.events.PaintListener;
-+import org.eclipse.swt.graphics.Color;
-+import org.eclipse.swt.graphics.GC;
-+import org.eclipse.swt.layout.GridData;
-+import org.eclipse.swt.layout.GridLayout;
-+import org.eclipse.swt.widgets.Canvas;
-+import org.eclipse.swt.widgets.Composite;
-+import org.eclipse.swt.widgets.Display;
-+
-+public class ThreadProfilerView extends SystemTapView {
-+ private static final int CPU_BUFFER = 0;
-+ private static final int MEM_BUFFER = 1;
-+ private static final int DISK_BUFFER = 2;
-+
-+ private static final int START_X_POS = 50;
-+ private ArrayList<GraphModel> graphs;
-+ private ArrayList<ThreadGraph> threads;
-+
-+ private Composite graphCanvas;
-+ private Canvas threadCanvas;
-+ private final static int GRAPH_SEPARATION = 40;
-+ private int segments;
-+
-+ /*
-+ * We have two frames of reference:
-+ *
-+ * 1. Pixel frame (absolute frame)
-+ * 2. Axis frame (relative frame)
-+ *
-+ * The transformation from 1 to 2 is a coordinate shift and scale
-+ *
-+ */
-+
-+
-+ @Override
-+ protected boolean createOpenAction() {
-+ return false;
-+ }
-+
-+ @Override
-+ protected boolean createOpenDefaultAction() {
-+ return false;
-+ }
-+
-+ @Override
-+ public IStatus initializeView(Display targetDisplay,
-+ IProgressMonitor monitor) {
-+ if (graphs == null)
-+ graphs = new ArrayList<GraphModel>();
-+ if (threads == null)
-+ threads = new ArrayList<ThreadGraph>();
-+ graphs.clear();
-+ threads.clear();
-+ segments = 0;
-+
-+ //Create dataSet for CPU
-+ createNewDataSet("CPU", GraphModel.CONSTANT_Y, "%");
-+ ((MultiGraph) graphs.get(0)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-+ ((MultiGraph) graphs.get(0)).addBuffer(GraphModel.BUFFER_SIZE, "IO Block");
-+
-+ //Create dataSet for memory
-+ createNewDataSet("Memory", GraphModel.FLEXIBLE_Y, "bytes");
-+ ((MultiGraph) graphs.get(1)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-+ ((MultiGraph) graphs.get(1)).addBuffer(GraphModel.BUFFER_SIZE, "Data");
-+
-+ //Create dataSet for disk usage
-+ createNewDataSet("Disk", GraphModel.FLEXIBLE_Y, "bytes");
-+ ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Total");
-+ ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Read");
-+ ((MultiGraph) graphs.get(2)).addBuffer(GraphModel.BUFFER_SIZE, "Write");
-+ ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_FILL);
-+ ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_LINE);
-+ ((MultiGraph) graphs.get(2)).addStyle(MultiGraph.GRAPH_STYLE_LINE);
-+
-+ graphCanvas.addMouseListener(new MouseListener() {
-+
-+ @Override
-+ public void mouseDoubleClick(MouseEvent e) {
-+ updateMethod();
-+ }
-+
-+ @Override
-+ public void mouseDown(MouseEvent e) {
-+ System.out.println("LOCATION: " + e.x + "," + e.y);
-+ }
-+
-+ @Override
-+ public void mouseUp(MouseEvent e) {
-+ // TODO Auto-generated method stub
-+
-+ }
-+
-+ });
-+
-+ graphCanvas.addPaintListener(new PaintListener() {
-+ public void paintControl(PaintEvent e) {
-+ //TODO: If the script is running and the graph is not changed,
-+ //there is no need to update yet.
-+ for (int i = 0; i < graphs.size(); i ++) {
-+ GraphModel graph = graphs.get(i);
-+ GC gc = new GC(graphCanvas);
-+ gc.setLineWidth(2);
-+ graph.setHeight((int) (graphCanvas.getSize().y/(2.5*graphs.size())));
-+ graph.setYAxisCoordinate((graph.getHeight() + GRAPH_SEPARATION) *(i + 1));
-+ graph.drawOn(gc, graphCanvas);
-+ gc.dispose();
-+ }
-+ }
-+ });
-+
-+
-+ threadCanvas.addPaintListener(new PaintListener() {
-+
-+
-+ @Override
-+ public void paintControl(PaintEvent e) {
-+ if (threads == null)
-+ return;
-+ int yOffset = GRAPH_SEPARATION;
-+
-+ GC gc = new GC(threadCanvas);
-+ Color fg = new Color(Display.getCurrent(), 0, 0, 200);
-+ gc.setForeground(fg);
-+
-+ int counter = 0;
-+ ArrayList<ThreadGraph> toRemove = new ArrayList<ThreadGraph>();
-+ for (ThreadGraph tg : threads) {
-+ counter++;
-+ tg.setYAxisCoordinate(counter*yOffset);
-+ gc.setLineWidth(2);
-+ tg.drawOn(gc, graphCanvas);
-+ gc.setLineWidth(0);
-+ gc.drawText(tg.getTitle(), START_X_POS, counter*yOffset, true);
-+ if (tg.isEmpty())
-+ toRemove.add(tg);
-+ }
-+ //TODO: O(N^2) operation
-+ threads.removeAll(toRemove);
-+ fg.dispose();
-+ gc.dispose();
-+ }
-+ });
-+
-+ return Status.OK_STATUS;
-+ }
-+
-+ private void createNewDataSet(String name, int type, String units) {
-+ GraphModel graph = new MultiGraph(name, START_X_POS, (GraphModel.DEFAULT_HEIGHT + GRAPH_SEPARATION) *(graphs.size() + 1), type, units);
-+ graphs.add(graph);
-+ }
-+
-+ @Override
-+ public void setViewID() {
-+ viewID = "org.eclipse.linuxtools.internal.threadprofiler.ThreadProfilerView";
-+ }
-+
-+ @Override
-+ public void updateMethod() {
-+ graphCanvas.redraw();
-+ threadCanvas.redraw();
-+ }
-+
-+ @Override
-+ public void createPartControl(Composite parent) {
-+ GridLayout gl = new GridLayout(1, true);
-+ parent.setLayout(gl);
-+ Color white = new Color(Display.getCurrent(), 255, 255, 255);
-+
-+ ScrolledComposite graphComp =new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL);
-+ graphComp.setLayout (new GridLayout(1, true));
-+ graphComp.setBackground(white);
-+ GridData gd = new GridData(GridData.FILL_BOTH);
-+ gd.grabExcessHorizontalSpace = true;
-+ graphComp.setLayoutData(gd);
-+
-+ graphCanvas = new Canvas(graphComp, SWT.BORDER | SWT.V_SCROLL);
-+ graphCanvas.setBackground(white);
-+ gd = new GridData(GridData.FILL_BOTH);
-+ gd.grabExcessHorizontalSpace = true;
-+ graphCanvas.setLayoutData(gd);
-+
-+ ScrolledComposite threadComp =new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL);
-+ threadComp.setLayout (new GridLayout(1, true));
-+ threadComp.setBackground(white);
-+ gd = new GridData(GridData.FILL_BOTH);
-+ gd.grabExcessHorizontalSpace = true;
-+ threadComp.setLayoutData(gd);
-+
-+ threadCanvas = new Canvas(graphComp, SWT.BORDER | SWT.V_SCROLL);
-+ threadCanvas.setBackground(white);
-+ gd = new GridData(GridData.FILL_BOTH);
-+ gd.grabExcessHorizontalSpace = true;
-+ threadCanvas.setLayoutData(gd);
-+ }
-+
-+ @Override
-+ public void setFocus() {
-+ //Do nothing
-+ }
-+
-+
-+
-+ public void addDataPoints(int counter, String[] blargh) {
-+ if (segments < GraphModel.BUFFER_SIZE)
-+ segments++;
-+ if (blargh.length < 2)
-+ return;
-+ this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[1]), 1), CPU_BUFFER, 0);
-+
-+ if (blargh.length < 3)
-+ return;
-+ this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[2]), 1), CPU_BUFFER, 1);
-+
-+ if (blargh.length < 4)
-+ return;
-+ this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[3]), 1), MEM_BUFFER, 0);
-+
-+ if (blargh.length < 5)
-+ return;
-+ this.addPoint(new DataPoint(counter, Integer.parseInt(blargh[4]), 1), MEM_BUFFER, 1);
-+
-+ if (blargh.length < 6)
-+ return;
-+ addPoint(new DataPoint(counter, Integer.parseInt(blargh[5]), 1), DISK_BUFFER, 0);
-+
-+ if (blargh.length < 7)
-+ return;
-+ addPoint(new DataPoint(counter, Integer.parseInt(blargh[6]), 1), DISK_BUFFER, 1);
-+
-+ if (blargh.length < 8)
-+ return;
-+ addPoint(new DataPoint(counter, Integer.parseInt(blargh[7]), 1), DISK_BUFFER, 2);
-+ }
-+
-+
-+ private void addPoint(DataPoint point, int dataSet, int subIndex) {
-+ if (graphs.size() < 1)
-+ return;
-+ graphs.get(dataSet).add(point, subIndex);
-+ }
-+
-+ public void addThread(int tid, String line) {
-+ int i = threadExists(tid);
-+ if (i < 0) {
-+ ThreadGraph tg = new ThreadGraph(line, START_X_POS, GRAPH_SEPARATION, 0, "", tid);
-+ for (int j = 0; j < segments; j++) {
-+ //Fill with empty segments
-+ tg.add(new DataPoint(0, 0, DataPoint.INACTIVE), 0);
-+ }
-+ threads.add(tg);
-+ i = threads.size() - 1;
-+ }
-+ threads.get(i).prep(new DataPoint(0, 0, DataPoint.ACTIVE), 0);
-+ }
-+
-+
-+ public void closeThreads() {
-+ // TODO Auto-generated method stub
-+ for (ThreadGraph tg : threads) {
-+ tg.tick();
-+ }
-+ }
-+
-+ /**
-+ * Returns true if a thread with the given tid exists
-+ *
-+ * @param tid
-+ * @return
-+ */
-+ private int threadExists(int tid) {
-+ for (int i = 0; i < threads.size(); i++) {
-+ if (threads.get(i).getTid() == tid) {
-+ return i;
-+ }
-+ }
-+ return -1;
-+ }
-+
-+
-+
- }
-\ No newline at end of file
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/graphs/GraphModel.java b/src/org/eclipse/linuxtools/threadprofiler/graphs/GraphModel.java
-index 5bf0531..1b07e18 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/graphs/GraphModel.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/graphs/GraphModel.java
-@@ -1,226 +1,229 @@
--package org.eclipse.linuxtools.internal.threadprofiler.graphs;
--
--import java.util.ArrayList;
--import java.util.Iterator;
--
--import org.eclipse.linuxtools.internal.threadprofiler.CircularPointBuffer;
--import org.eclipse.linuxtools.internal.threadprofiler.CoordinateSystem;
--import org.eclipse.linuxtools.internal.threadprofiler.DataPoint;
--import org.eclipse.linuxtools.internal.threadprofiler.GraphAxis;
--import org.eclipse.swt.graphics.Color;
--import org.eclipse.swt.graphics.GC;
--import org.eclipse.swt.widgets.Canvas;
--import org.eclipse.swt.widgets.Composite;
--import org.eclipse.swt.widgets.Display;
--
--public abstract class GraphModel {
--
-- //Constant Y scale
-- public static final int CONSTANT_Y = 0;
-- //Change Y scale as the maximum y point increases
-- public static final int FLEXIBLE_Y = 1;
-- //Maximum buffer size
-- public static final int BUFFER_SIZE = 30;
-- //Default height
-- public static final int DEFAULT_HEIGHT = 100;
--
-- private final CoordinateSystem coordinates;
-- private final DataPoint startPoint;
-- private final int graphType;
-- private final String title;
-- private final String units;
-- private boolean changed;
-- protected final ArrayList<CircularPointBuffer> data;
--
-- private int height;
--
-- private int maxY;
-- //Height in pixels
--
-- public GraphModel(String name, int x, int y, int type, String units) {
-- graphType = type;
-- changed = false;
-- data = new ArrayList<CircularPointBuffer>();
-- title = name;
-- this.units = units;
-- height = DEFAULT_HEIGHT;
-- maxY = 100;
-- coordinates = new CoordinateSystem(x, y);
-- coordinates.setYScale(0.2);
-- coordinates.getAxis().setTopLabel(DEFAULT_HEIGHT + units);
--
-- startPoint = new DataPoint(coordinates.getXOffset(), coordinates.getYOffset(), 1);
-- }
--
-- public void setMaxY(int max) {
-- maxY = max;
-- }
--
-- public int getXOffset() {
-- return (int) coordinates.getAxisToPixel().entries[0][2];
-- }
--
-- public int getYOffset() {
-- return (int) coordinates.getAxisToPixel().entries[1][2];
-- }
--
--
-- /**
-- *
-- * @return
-- * First available point buffer if any is available, else null
-- */
-- public Iterator<DataPoint> getPointBuffer() {
-- if (data.size() > 1)
-- return getPointBuffer(0);
-- return null;
-- }
--
-- public Iterator<DataPoint> getPointBuffer(int index) {
-- return data.get(index).getIterator();
-- }
--
-- public GraphAxis getAxis() {
-- return coordinates.getAxis();
-- }
--
-- public DataPoint getStartPoint() {
-- return startPoint;
-- }
--
-- public void add(DataPoint point, int subIndex) {
-- if (subIndex >= data.size()) {
-- data.add(new CircularPointBuffer(BUFFER_SIZE));
-- }
-- if (graphType == FLEXIBLE_Y) {
-- if (point.getY() > maxY ) {
-- maxY = point.getY();
-- coordinates.getAxis().setTopLabel(maxY + " " + units);
-- if ( point.getY() > height) {
-- double newScale = (double) height/maxY;
-- coordinates.setYScale(newScale);
-- }
-- }
-- }
-- data.get(subIndex).add(point);
-- setChanged(true);
-- }
--
-- public DataPoint transform(DataPoint toTransform) {
-- return coordinates.dataToPixel(toTransform);
-- }
--
-- public boolean isChanged() {
-- return changed;
-- }
--
-- public void setChanged(boolean val) {
-- changed = val;
-- }
--
-- public String getTitle() {
-- return title;
-- }
--
-- public int getHeight() {
-- return height;
-- }
--
-- public void setHeight(int value) {
-- if (height == value)
-- return;
-- height = value;
-- double newScale = (double) height/maxY;
-- coordinates.setYScale(newScale);
-- }
--
--
-- public void setYAxisCoordinate(int value) {
-- coordinates.setYAxisCoordinate(value);
-- startPoint.setY(value);
-- }
--
-- public void setXAxisCoordinate(int value) {
-- coordinates.setXAxisCoordinate(value);
-- startPoint.setX(value);
-- }
--
--
-- public CoordinateSystem getCoordinates() {
-- return coordinates;
-- }
--
-- /**
-- * The main draw function -- implement this method to change
-- * the way things are graphed
-- *
-- * @param gc
-- * @param graphCanvas
-- */
-- public abstract void drawOn(GC gc, Composite graphCanvas);
--
--
-- protected void drawLine(GC gc, DataPoint p1, DataPoint p2) {
-- gc.drawLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
-- }
--
-- /**
-- *
-- * @return
-- * Number of data buffers in this model
-- */
-- public int getBufferCount() {
-- return data.size();
-- }
--
-- /**
-- * Draws the x-axis and sets up the graph's title.
-- * Also draws graduations for the x-axis
-- *
-- * @param gc
-- * @param width
-- */
-- protected void drawAxis(GC gc, int width) {
-- gc.setLineWidth(2);
-- gc.drawLine(getXOffset(), getYOffset(), width, getYOffset());
-- int xSeg = getXOffset();
-- int increment = width/BUFFER_SIZE;
-- while (xSeg < width) {
-- gc.drawLine(xSeg, getYOffset(), xSeg, getYOffset() - getHeight());
-- xSeg += increment;
-- }
-- gc.setForeground(new Color(Display.getCurrent(), 10, 10, 10));
-- gc.drawText(getTitle(), getXOffset(), getYOffset() + 5, true);
--// gc.drawText(this.getCoordinates().getAxis().getTopLabel(), this.getXOffset(), this.getYOffset() - this.getHeight(), true);
-- }
--
-- protected void drawFillPolygons(GC gc, Composite graphCanvas, Iterator<DataPoint> nextPointBuffer) {
-- DataPoint pp = this.getStartPoint();
-- int xSeg = this.getXOffset();
-- int increment = (graphCanvas.getSize().x - this.getXOffset())/GraphModel.BUFFER_SIZE;
--
-- gc.setLineWidth(0);
-- while (nextPointBuffer.hasNext()) {
-- gc.setAlpha(170);
-- DataPoint nextPoint = new DataPoint(xSeg, this.transform(nextPointBuffer.next()).getY(), 0);
-- //Use old point, new point, and the corresponding intersections with the x-axis to fill
-- gc.fillPolygon(new int[] {pp.getX(), pp.getY(), nextPoint.getX(), nextPoint.getY(), nextPoint.getX(), getStartPoint().getY(), pp.getX(), getStartPoint().getY()});
-- xSeg += increment;
-- pp = nextPoint;
-- }
-- }
--
-- protected void drawLines(GC gc, Composite graphCanvas, Iterator<DataPoint> nextPointBuffer) {
-- DataPoint pp = this.getStartPoint();
-- int xSeg = this.getXOffset();
-- int increment = (graphCanvas.getSize().x - this.getXOffset())/GraphModel.BUFFER_SIZE;
--
-- while (nextPointBuffer.hasNext()) {
-- DataPoint nextPoint = new DataPoint(xSeg, this.transform(nextPointBuffer.next()).getY(), 0);
-- xSeg += increment;
-- drawLine(gc, pp, nextPoint);
-- pp = nextPoint;
-- }
-- }
--
--}
-+package org.eclipse.linuxtools.internal.threadprofiler.graphs;
-+
-+import java.util.ArrayList;
-+import java.util.Iterator;
-+
-+import org.eclipse.linuxtools.internal.threadprofiler.CircularPointBuffer;
-+import org.eclipse.linuxtools.internal.threadprofiler.CoordinateSystem;
-+import org.eclipse.linuxtools.internal.threadprofiler.DataPoint;
-+import org.eclipse.linuxtools.internal.threadprofiler.GraphAxis;
-+import org.eclipse.swt.graphics.Color;
-+import org.eclipse.swt.graphics.GC;
-+import org.eclipse.swt.widgets.Canvas;
-+import org.eclipse.swt.widgets.Composite;
-+import org.eclipse.swt.widgets.Display;
-+
-+public abstract class GraphModel {
-+
-+ //Constant Y scale
-+ public static final int CONSTANT_Y = 0;
-+ //Change Y scale as the maximum y point increases
-+ public static final int FLEXIBLE_Y = 1;
-+ /** Maximum buffer size. This affects the number of data points*/
-+ public static final int BUFFER_SIZE = 100;
-+ //Default height
-+ public static final int DEFAULT_HEIGHT = 100;
-+
-+ /** Number of spaces between graduations on the axis */
-+ private static final int GRADUATION_SEPARATION = 5;
-+
-+ private final CoordinateSystem coordinates;
-+ private final DataPoint startPoint;
-+ private final int graphType;
-+ private final String title;
-+ private final String units;
-+ private boolean changed;
-+ protected final ArrayList<CircularPointBuffer> data;
-+
-+ private int height;
-+
-+ private int maxY;
-+ //Height in pixels
-+
-+ public GraphModel(String name, int x, int y, int type, String units) {
-+ graphType = type;
-+ changed = false;
-+ data = new ArrayList<CircularPointBuffer>();
-+ title = name;
-+ this.units = units;
-+ height = DEFAULT_HEIGHT;
-+ maxY = 100;
-+ coordinates = new CoordinateSystem(x, y);
-+ coordinates.setYScale(0.2);
-+ coordinates.getAxis().setTopLabel(DEFAULT_HEIGHT + units);
-+
-+ startPoint = new DataPoint(coordinates.getXOffset(), coordinates.getYOffset(), 1);
-+ }
-+
-+ public void setMaxY(int max) {
-+ maxY = max;
-+ }
-+
-+ public int getXOffset() {
-+ return (int) coordinates.getAxisToPixel().entries[0][2];
-+ }
-+
-+ public int getYOffset() {
-+ return (int) coordinates.getAxisToPixel().entries[1][2];
-+ }
-+
-+
-+ /**
-+ *
-+ * @return
-+ * First available point buffer if any is available, else null
-+ */
-+ public Iterator<DataPoint> getPointBuffer() {
-+ if (data.size() > 1)
-+ return getPointBuffer(0);
-+ return null;
-+ }
-+
-+ public Iterator<DataPoint> getPointBuffer(int index) {
-+ return data.get(index).getIterator();
-+ }
-+
-+ public GraphAxis getAxis() {
-+ return coordinates.getAxis();
-+ }
-+
-+ public DataPoint getStartPoint() {
-+ return startPoint;
-+ }
-+
-+ public void add(DataPoint point, int subIndex) {
-+ if (subIndex >= data.size()) {
-+ data.add(new CircularPointBuffer(BUFFER_SIZE));
-+ }
-+ if (graphType == FLEXIBLE_Y) {
-+ if (point.getY() > maxY ) {
-+ maxY = point.getY();
-+ coordinates.getAxis().setTopLabel(maxY + " " + units);
-+ if ( point.getY() > height) {
-+ double newScale = (double) height/maxY;
-+ coordinates.setYScale(newScale);
-+ }
-+ }
-+ }
-+ data.get(subIndex).add(point);
-+ setChanged(true);
-+ }
-+
-+ public DataPoint transform(DataPoint toTransform) {
-+ return coordinates.dataToPixel(toTransform);
-+ }
-+
-+ public boolean isChanged() {
-+ return changed;
-+ }
-+
-+ public void setChanged(boolean val) {
-+ changed = val;
-+ }
-+
-+ public String getTitle() {
-+ return title;
-+ }
-+
-+ public int getHeight() {
-+ return height;
-+ }
-+
-+ public void setHeight(int value) {
-+ if (height == value)
-+ return;
-+ height = value;
-+ double newScale = (double) height/maxY;
-+ coordinates.setYScale(newScale);
-+ }
-+
-+
-+ public void setYAxisCoordinate(int value) {
-+ coordinates.setYAxisCoordinate(value);
-+ startPoint.setY(value);
-+ }
-+
-+ public void setXAxisCoordinate(int value) {
-+ coordinates.setXAxisCoordinate(value);
-+ startPoint.setX(value);
-+ }
-+
-+
-+ public CoordinateSystem getCoordinates() {
-+ return coordinates;
-+ }
-+
-+ /**
-+ * The main draw function -- implement this method to change
-+ * the way things are graphed
-+ *
-+ * @param gc
-+ * @param graphCanvas
-+ */
-+ public abstract void drawOn(GC gc, Composite graphCanvas);
-+
-+
-+ protected void drawLine(GC gc, DataPoint p1, DataPoint p2) {
-+ gc.drawLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
-+ }
-+
-+ /**
-+ *
-+ * @return
-+ * Number of data buffers in this model
-+ */
-+ public int getBufferCount() {
-+ return data.size();
-+ }
-+
-+ /**
-+ * Draws the x-axis and sets up the graph's title.
-+ * Also draws graduations for the x-axis
-+ *
-+ * @param gc
-+ * @param width
-+ */
-+ protected void drawAxis(GC gc, int width) {
-+ gc.setLineWidth(2);
-+ gc.drawLine(getXOffset(), getYOffset(), width, getYOffset());
-+ int xSeg = getXOffset();
-+ int increment = width/BUFFER_SIZE;
-+ while (xSeg < width) {
-+ gc.drawLine(xSeg, getYOffset(), xSeg, getYOffset() - getHeight());
-+ xSeg += GRADUATION_SEPARATION * increment;
-+ }
-+ gc.setForeground(new Color(Display.getCurrent(), 10, 10, 10));
-+ gc.drawText(getTitle(), getXOffset(), getYOffset() + 5, true);
-+// gc.drawText(this.getCoordinates().getAxis().getTopLabel(), this.getXOffset(), this.getYOffset() - this.getHeight(), true);
-+ }
-+
-+ protected void drawFillPolygons(GC gc, Composite graphCanvas, Iterator<DataPoint> nextPointBuffer) {
-+ DataPoint pp = this.getStartPoint();
-+ int xSeg = this.getXOffset();
-+ int increment = (graphCanvas.getSize().x - this.getXOffset())/GraphModel.BUFFER_SIZE;
-+
-+ gc.setLineWidth(0);
-+ while (nextPointBuffer.hasNext()) {
-+ gc.setAlpha(170);
-+ DataPoint nextPoint = new DataPoint(xSeg, this.transform(nextPointBuffer.next()).getY(), 0);
-+ //Use old point, new point, and the corresponding intersections with the x-axis to fill
-+ gc.fillPolygon(new int[] {pp.getX(), pp.getY(), nextPoint.getX(), nextPoint.getY(), nextPoint.getX(), getStartPoint().getY(), pp.getX(), getStartPoint().getY()});
-+ xSeg += increment;
-+ pp = nextPoint;
-+ }
-+ }
-+
-+ protected void drawLines(GC gc, Composite graphCanvas, Iterator<DataPoint> nextPointBuffer) {
-+ DataPoint pp = this.getStartPoint();
-+ int xSeg = this.getXOffset();
-+ int increment = (graphCanvas.getSize().x - this.getXOffset())/GraphModel.BUFFER_SIZE;
-+
-+ while (nextPointBuffer.hasNext()) {
-+ DataPoint nextPoint = new DataPoint(xSeg, this.transform(nextPointBuffer.next()).getY(), 0);
-+ xSeg += increment;
-+ drawLine(gc, pp, nextPoint);
-+ pp = nextPoint;
-+ }
-+ }
-+
-+}
-diff --git a/src/org/eclipse/linuxtools/threadprofiler/graphs/MultiGraph.java b/src/org/eclipse/linuxtools/threadprofiler/graphs/MultiGraph.java
-index ee3565e..5d958b2 100644
---- a/src/org/eclipse/linuxtools/threadprofiler/graphs/MultiGraph.java
-+++ b/src/org/eclipse/linuxtools/threadprofiler/graphs/MultiGraph.java
-@@ -80,6 +80,7 @@ public class MultiGraph extends GraphModel {
- gc.setBackground(oldBg);
- }
-
-+ gc.setLineWidth(0);
- gc.drawText(getPointBuffer(i).toString(), xPos, yPos);
- prev = getPointBuffer(i).toString();
- xPos = xPos + separation(prev);
diff --git a/systemtap/pom.xml b/systemtap/pom.xml
index 5b754ca5b5..2904917673 100644
--- a/systemtap/pom.xml
+++ b/systemtap/pom.xml
@@ -83,8 +83,6 @@
<module>org.eclipse.linuxtools.systemtap.ui.structures.tests</module>
<module>org.eclipse.linuxtools.systemtap.ui.systemtapgui</module>
<module>org.eclipse.linuxtools.systemtap.ui.tests</module>
- <module>org.eclipse.linuxtools.threadprofiler</module>
- <module>org.eclipse.linuxtools.threadprofiler.feature</module>
</modules>
</project>

Back to the top