Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Overholt2011-02-28 03:19:21 +0000
committerAndrew Overholt2011-02-28 03:19:21 +0000
commit51d4c40998a516064ecc6f6d2d897b5fd1733fb6 (patch)
treea1600ffc107f8073d147be7354c58c7ca54f06ba
parentc913a9b4eed1bc4bb11a9b3b5e4450819c9ff7e8 (diff)
parent30c6c19e8aea72c9a6db706bafb88b61f8359606 (diff)
downloadorg.eclipse.linuxtools-51d4c40998a516064ecc6f6d2d897b5fd1733fb6.tar.gz
org.eclipse.linuxtools-51d4c40998a516064ecc6f6d2d897b5fd1733fb6.tar.xz
org.eclipse.linuxtools-51d4c40998a516064ecc6f6d2d897b5fd1733fb6.zip
Merge oprofile 0.6.0
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/.project17
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/ChangeLog54
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/build.properties9
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/epl-v10.html256
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/feature.properties138
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/feature.xml101
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile-feature/license.html107
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/META-INF/MANIFEST.MF12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/build.properties15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.xml11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/src/org/eclipse/linuxtools/oprofile/core/linux/ppc/LinuxOpxmlProviderPPC.java46
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/META-INF/MANIFEST.MF11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/build.properties15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.xml11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/src/org/eclipse/linuxtools/oprofile/core/linux/x86/LinuxOpxmlProvider32.java47
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/META-INF/MANIFEST.MF11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/build.properties15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.xml11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/src/org/eclipse/linuxtools/oprofile/core/linux/x86_64/LinuxOpxmlProvider64.java46
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/ChangeLog9
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/META-INF/MANIFEST.MF22
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/build.properties14
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/plugin.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_counter.xml4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_event.xml4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_umask.xml4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_ok.xml4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info.xml140
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info_0ctrs.xml4
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data.xml77
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data_multiple_image.xml217
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_sessions.xml18
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java30
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java60
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestCheckEventsParse.java73
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDataModel.java61
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestInfoParse.java418
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestModelDataParse.java180
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestSessionsParse.java115
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core.tests/test.xml54
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/ChangeLog21
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/META-INF/MANIFEST.MF21
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/README23
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/build.properties19
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/.svnignore15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/Makefile78
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/README8
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.cc35
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.h48
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/move_opxml.sh27
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.cc225
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.h118
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.cc160
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.h92
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opxml.cc495
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oxmlstream.h27
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.cc341
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.h106
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.cc57
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.h78
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.cc248
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.h140
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.cc203
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.h59
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.cc105
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.h63
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.cc294
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.h87
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.cc85
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.h97
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.cc101
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.h62
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.cc79
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.h52
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.cc157
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.h101
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/.svnignore2
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install-noconsolehelper.sh53
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install.sh71
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.pamd9
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.security3
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall-noconsolehelper.sh23
-rwxr-xr-xoprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall.sh22
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/plugin.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/plugin.xml6
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/schema/OpxmlProvider.exsd70
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpcontrolProvider.java85
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpxmlProvider.java62
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpcontrolException.java24
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java225
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileCorePlugin.java177
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileProperties.java31
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpxmlException.java33
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpEvent.java118
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java214
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpUnitMask.java244
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonEvent.java118
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonOptions.java141
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java343
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpxmlProvider.java124
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java105
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelEvent.java66
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelImage.java140
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelRoot.java78
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSample.java48
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSession.java85
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSymbol.java84
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/oprofile.properties49
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java184
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OpxmlConstants.java43
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/XMLProcessor.java79
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/checkevent/CheckEventsProcessor.java63
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/DefaultsProcessor.java50
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/EventListProcessor.java241
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java80
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/DependentProcessor.java75
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/ModelDataProcessor.java92
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SamplesProcessor.java63
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SymbolsProcessor.java80
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/sessions/SessionsProcessor.java89
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/ChangeLog44
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/META-INF/MANIFEST.MF11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/build-helper.xml151
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/build.properties19
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/doc/notices.html22
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/extract-markup.xsl9
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.properties2
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.xml19
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/MediaWikiImageFetcher.java149
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/toc.xml7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Example-Project.html63
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Installation-and-Set-Up.html156
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Launching-A-Profile.html93
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference-toc.xml46
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.html53
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.xml959
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile-View.html148
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Profiling-Configuration.html227
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Troubleshooting.html278
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Updating-This-Document.html54
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_dependent.gifbin0 -> 364 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_event.gifbin0 -> 617 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_image.gifbin0 -> 357 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_sample.gifbin0 -> 561 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_session.gifbin0 -> 372 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_symbol.gifbin0 -> 89 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/LinuxTools-0.2.0-OProfile-Screenshot.pngbin0 -> 69827 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_dialog.pngbin0 -> 12126 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_shortcut.pngbin0 -> 9436 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-global_config.pngbin0 -> 46090 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-installscript_error_dialog.pngbin0 -> 126665 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-one-click_launch.pngbin0 -> 93518 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-opcontrol_consolehelper.pngbin0 -> 18444 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_event_timer.pngbin0 -> 37908 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_eventconfig.pngbin0 -> 66787 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_global_differences.pngbin0 -> 52748 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_save_session.pngbin0 -> 8805 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_view_full.pngbin0 -> 40368 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofiled_log_reader.pngbin0 -> 35457 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/META-INF/MANIFEST.MF26
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/build.properties13
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/plugin.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.cproject593
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.project81
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/primeTest.c36
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.cproject593
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.project81
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/sleepTest.c6
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/AllLaunchTests.java32
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/LaunchTestsPlugin.java70
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestDummy.java22
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestLaunching.java140
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestManualLaunching.java140
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestSetup.java151
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch.tests/test.xml54
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/META-INF/MANIFEST.MF30
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/build.properties15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/icons/event_tab.gifbin0 -> 617 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/icons/global_tab.gifbin0 -> 362 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_manual_run.pngbin0 -> 720 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_run.pngbin0 -> 604 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.properties27
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.xml129
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchMessages.java30
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchPlugin.java115
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/EventConfigCache.java91
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java129
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java253
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileEventConfigTab.java800
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileLaunchConfigurationTabGroup.java21
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileSetupTab.java280
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java189
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchConfigurationDelegate.java98
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchShortcut.java64
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchConfigurationDelegate.java296
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchShortcut.java62
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/oprofilelaunch.properties68
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/.project17
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/ChangeLog18
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/build.properties9
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/epl-v10.html256
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.properties138
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.xml60
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.test-feature/license.html107
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/META-INF/MANIFEST.MF15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/build.properties11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/plugin.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data.xml77
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_multiple_image.xml217
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_nodepimage.xml39
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestPlugin.java64
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelRoot.java38
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession.java74
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession2.java74
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession3.java73
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession4.java30
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/META-INF/MANIFEST.MF17
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/build.properties11
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/plugin.properties12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/AllUiTests.java26
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/TestUiDataModel.java678
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/UiTestsPlugin.java60
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui.tests/test.xml54
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/.classpath7
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/.project28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/.svnignore1
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/META-INF/MANIFEST.MF33
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/about.html28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/build.properties15
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/annotate.pngbin0 -> 450 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dependent.gifbin0 -> 364 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dump.gifbin0 -> 245 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/error.pngbin0 -> 378 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/event.gifbin0 -> 617 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/image.gifbin0 -> 357 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/oprofile_view.pngbin0 -> 604 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/sample.gifbin0 -> 561 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/session.gifbin0 -> 372 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/icons/symbol.gifbin0 -> 89 bytes
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.properties28
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.xml19
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiMessages.java39
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java142
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/IUiModelElement.java49
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelDependent.java70
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelError.java46
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelEvent.java71
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelImage.java96
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelRoot.java91
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSample.java65
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSession.java89
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSymbol.java96
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/oprofileui.properties41
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileView.java138
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewContentProvider.java51
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java134
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLabelProvider.java51
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLogReaderAction.java142
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewRefreshAction.java29
-rw-r--r--oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java127
310 files changed, 22210 insertions, 0 deletions
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/.project b/oprofile/org.eclipse.linuxtools.oprofile-feature/.project
new file mode 100644
index 0000000000..e08eda091a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile-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/oprofile/org.eclipse.linuxtools.oprofile-feature/ChangeLog b/oprofile/org.eclipse.linuxtools.oprofile-feature/ChangeLog
new file mode 100644
index 0000000000..fc9beb67ef
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/ChangeLog
@@ -0,0 +1,54 @@
+2010-05-18 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Fix provider name.
+
+2010-04-26 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Match consistent license text (bug #306627). Update
+ copyright year.
+ * license.html: New file. HTML version of SUA (bug #306627).
+ * build.properties: Include license.html.
+
+2010-04-13 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Restrict to os=linux.
+
+2010-04-12 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Match consistent license text (bug #306627).
+
+2009-05-21 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Remove unnecessary ".feature" qualifier in requirement of
+ profilingframework.
+
+2009-05-20 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Remove unnecessary .feature qualifier.
+
+2009-05-19 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Change provider from Eclipse.org to Eclipse.
+
+2009-04-20 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Add ws qualifiers.
+
+2009-04-20 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Add os and arch qualifiers to fragment stanzas.
+
+2009-01-14 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Re-add update site information.
+
+2009-01-06 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Add dependencies. Add update site information.
+
+2008-12-18 Andrew Overholt <overholt@redhat.com>
+
+ * build.properties: Inital checkin.
+ * feature.xml: Likewise.
+ * feature.properties: Likewise.
+ * epl-v10.html: Likewise. \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/build.properties b/oprofile/org.eclipse.linuxtools.oprofile-feature/build.properties
new file mode 100644
index 0000000000..4a2e637799
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/build.properties
@@ -0,0 +1,9 @@
+bin.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ license.html
+src.includes = epl-v10.html,\
+ feature.properties,\
+ feature.xml,\
+ license.html,\
+ ChangeLog
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/epl-v10.html b/oprofile/org.eclipse.linuxtools.oprofile-feature/epl-v10.html
new file mode 100644
index 0000000000..9321f4082e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/epl-v10.html
@@ -0,0 +1,256 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Eclipse Public License - Version 1.0</title>
+
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style></head><body lang="EN-US">
+
+<p align="center"><b>Eclipse Public License - v 1.0</b></p>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body></html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.properties b/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.properties
new file mode 100644
index 0000000000..0e355b8786
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.properties
@@ -0,0 +1,138 @@
+#*******************************************************************************
+# 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=OProfile Integration (Incubation)
+description=Plugins to bring OProfile-based profiling into the workbench.
+provider=Eclipse Linux Tools
+copyright=Copyright 2008, 2010 Red Hat, Inc.
+licenseURL=license.html
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\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\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this 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 Foundation source code\n\
+repository ("Repository") in software 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\
+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\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update 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" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your 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\
+ - 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\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\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, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.xml b/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.xml
new file mode 100644
index 0000000000..1762f1b77e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/feature.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.linuxtools.oprofile"
+ label="%featureName"
+ version="0.3.0.qualifier"
+ provider-name="%featureProvider"
+ os="linux">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <url>
+ <update label="Linux Tools Update Site" url="http://download.eclipse.org/technology/linuxtools/update"/>
+ </url>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.cdt.core"/>
+ <import plugin="org.eclipse.cdt.debug.core"/>
+ <import plugin="org.eclipse.cdt.launch"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.linuxtools.profiling.launch"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.linuxtools.profiling.ui"/>
+ <import feature="org.eclipse.linuxtools.profiling" version="0.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui.editors" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.oprofile.core" version="0.1.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.help"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.launch"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.core.linux.x86"
+ os="linux"
+ ws="gtk"
+ arch="x86"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.core.linux.x86_64"
+ os="linux"
+ ws="gtk"
+ arch="x86_64"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.core.linux.ppc"
+ os="linux"
+ ws="gtk"
+ arch="ppc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.doc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile-feature/license.html b/oprofile/org.eclipse.linuxtools.oprofile-feature/license.html
new file mode 100644
index 0000000000..c184ca36a9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile-feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.project b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.project
new file mode 100644
index 0000000000..0bf69ac337
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.core.linux.ppc</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..4e94468fe0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Tue Mar 17 11:57:30 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..33a9ecbb1f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.core.linux.ppc;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Fragment-Host: org.eclipse.linuxtools.oprofile.core;bundle-version="0.1.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %bundleProvider
+Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=ppc))
+Bundle-Localization: fragment
+Import-Package: org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.linux
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/about.html b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/build.properties
new file mode 100644
index 0000000000..5920d6e869
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/build.properties
@@ -0,0 +1,15 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.xml,\
+ os/,\
+ fragment.properties,\
+ about.html
+src.includes = META-INF/,\
+ about.html,\
+ fragment.properties,\
+ fragment.xml,\
+ os/,\
+ src/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.properties
new file mode 100644
index 0000000000..242c5c3261
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# Copyright (c) 2009 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Core Linux PPC Fragment (Incubation)
+bundleProvider=Eclipse \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.xml
new file mode 100644
index 0000000000..a86122de76
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/fragment.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<fragment>
+ <extension
+ point="org.eclipse.linuxtools.oprofile.core.OpxmlProvider">
+ <opxmlProvider
+ class="org.eclipse.linuxtools.oprofile.core.linux.ppc.LinuxOpxmlProviderPPC">
+ </opxmlProvider>
+ </extension>
+
+</fragment>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/src/org/eclipse/linuxtools/oprofile/core/linux/ppc/LinuxOpxmlProviderPPC.java b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/src/org/eclipse/linuxtools/oprofile/core/linux/ppc/LinuxOpxmlProviderPPC.java
new file mode 100644
index 0000000000..a75e7483c6
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.ppc/src/org/eclipse/linuxtools/oprofile/core/linux/ppc/LinuxOpxmlProviderPPC.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux.ppc;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.linux.LinuxOpxmlProvider;
+
+public class LinuxOpxmlProviderPPC extends LinuxOpxmlProvider {
+ private static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core.linux.ppc"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_NAME = "opxml"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_PATH = "$os$"; //$NON-NLS-1$
+
+ public LinuxOpxmlProviderPPC() throws OpxmlException {
+ super();
+ }
+
+ @Override
+ public String _getOpxmlPath() {
+ String opxmlPath = null;
+ URL opxmlBinaryUrl = FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path(OPXML_BINARY_PATH + Path.SEPARATOR + OPXML_BINARY_NAME), null);
+
+ if (opxmlBinaryUrl != null) {
+ try {
+ opxmlPath = FileLocator.toFileURL(opxmlBinaryUrl).getPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return opxmlPath;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.project b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.project
new file mode 100644
index 0000000000..3ea4bebeb9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.core.linux.x86</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..213f5b6e58
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Wed Jan 07 11:21:45 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d35d803c58
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.core.linux.x86;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: %bundleProvider
+Fragment-Host: org.eclipse.linuxtools.oprofile.core;bundle-version="0.1.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86))
+Import-Package: org.eclipse.linuxtools.oprofile.core.linux
+Bundle-Localization: fragment
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/about.html b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/build.properties
new file mode 100644
index 0000000000..863422d3d0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/build.properties
@@ -0,0 +1,15 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.xml,\
+ about.html,\
+ fragment.properties,\
+ os/
+src.includes = about.html,\
+ META-INF/,\
+ fragment.xml,\
+ fragment.properties,\
+ src/,\
+ os/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.properties
new file mode 100644
index 0000000000..fb866b4ec7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Core Linux x86 Fragment (Incubation)
+bundleProvider=Eclipse \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.xml
new file mode 100644
index 0000000000..9c7f111d94
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/fragment.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<fragment>
+ <extension
+ point="org.eclipse.linuxtools.oprofile.core.OpxmlProvider">
+ <opxmlProvider
+ class="org.eclipse.linuxtools.oprofile.core.linux.x86.LinuxOpxmlProvider32">
+ </opxmlProvider>
+ </extension>
+
+</fragment>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/src/org/eclipse/linuxtools/oprofile/core/linux/x86/LinuxOpxmlProvider32.java b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/src/org/eclipse/linuxtools/oprofile/core/linux/x86/LinuxOpxmlProvider32.java
new file mode 100644
index 0000000000..e250a917de
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86/src/org/eclipse/linuxtools/oprofile/core/linux/x86/LinuxOpxmlProvider32.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux.x86;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.linux.LinuxOpxmlProvider;
+
+
+public class LinuxOpxmlProvider32 extends LinuxOpxmlProvider {
+ private static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core.linux.x86"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_NAME = "opxml"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_PATH = "$os$"; //$NON-NLS-1$
+
+ public LinuxOpxmlProvider32() throws OpxmlException {
+ super();
+ }
+
+ @Override
+ public String _getOpxmlPath() {
+ String opxmlPath = null;
+ URL opxmlBinaryUrl = FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path(OPXML_BINARY_PATH + Path.SEPARATOR + OPXML_BINARY_NAME), null);
+
+ if (opxmlBinaryUrl != null) {
+ try {
+ opxmlPath = FileLocator.toFileURL(opxmlBinaryUrl).getPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return opxmlPath;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.project b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.project
new file mode 100644
index 0000000000..2399a11e7d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.core.linux.x86_64</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..ec5057ae74
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Wed Jan 07 11:21:57 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..abd6a658e8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.core.linux.x86_64;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: %bundleProvider
+Fragment-Host: org.eclipse.linuxtools.oprofile.core;bundle-version="0.1.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-PlatformFilter: (& (osgi.os=linux) (osgi.arch=x86_64))
+Import-Package: org.eclipse.linuxtools.oprofile.core.linux
+Bundle-Localization: fragment
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/about.html b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/build.properties
new file mode 100644
index 0000000000..e392e8adb7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/build.properties
@@ -0,0 +1,15 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.xml,\
+ about.html,\
+ fragment.properties,\
+ os/
+src.includes = META-INF/,\
+ about.html,\
+ fragment.properties,\
+ fragment.xml,\
+ os/,\
+ src/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.properties
new file mode 100644
index 0000000000..32ff95c380
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Core Linux x86_64 Fragment (Incubation)
+bundleProvider=Eclipse \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.xml
new file mode 100644
index 0000000000..c56483e1a1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/fragment.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<fragment>
+ <extension
+ point="org.eclipse.linuxtools.oprofile.core.OpxmlProvider">
+ <opxmlProvider
+ class="org.eclipse.linuxtools.oprofile.core.linux.x86_64.LinuxOpxmlProvider64">
+ </opxmlProvider>
+ </extension>
+
+</fragment>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/src/org/eclipse/linuxtools/oprofile/core/linux/x86_64/LinuxOpxmlProvider64.java b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/src/org/eclipse/linuxtools/oprofile/core/linux/x86_64/LinuxOpxmlProvider64.java
new file mode 100644
index 0000000000..c74ccacb76
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.linux.x86_64/src/org/eclipse/linuxtools/oprofile/core/linux/x86_64/LinuxOpxmlProvider64.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux.x86_64;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.linux.LinuxOpxmlProvider;
+
+public class LinuxOpxmlProvider64 extends LinuxOpxmlProvider {
+ private static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core.linux.x86_64"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_NAME = "opxml"; //$NON-NLS-1$
+ private static final String OPXML_BINARY_PATH = "$os$"; //$NON-NLS-1$
+
+ public LinuxOpxmlProvider64() throws OpxmlException {
+ super();
+ }
+
+ @Override
+ public String _getOpxmlPath() {
+ String opxmlPath = null;
+ URL opxmlBinaryUrl = FileLocator.find(Platform.getBundle(PLUGIN_ID), new Path(OPXML_BINARY_PATH + Path.SEPARATOR + OPXML_BINARY_NAME), null);
+
+ if (opxmlBinaryUrl != null) {
+ try {
+ opxmlPath = FileLocator.toFileURL(opxmlBinaryUrl).getPath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return opxmlPath;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.project b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.project
new file mode 100644
index 0000000000..775970bedc
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.core.tests</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..8858758938
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Thu Jan 15 11:55:42 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/ChangeLog b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/ChangeLog
new file mode 100644
index 0000000000..d5190fe10e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/ChangeLog
@@ -0,0 +1,9 @@
+2009-02-25 Andrew Overholt <overholt@redhat.com>
+
+ * test.xml: Clean up variable names.
+ * META-INF/MANIFEST.MF: Explicitly require JUnit 3.
+ * build.properties: Add test.xml.
+
+2009-02-02 Andrew Overholt <overholt@redhat.com>
+
+ * test.xml: Initial checkin. \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..1ca6686ef7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.core.tests
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.oprofile.core.tests.CoreTestsPlugin
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.4.1",
+ org.junit;bundle-version="3.8.2"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.daemon,
+ org.eclipse.linuxtools.oprofile.core.model,
+ org.eclipse.linuxtools.oprofile.core.opxml,
+ org.eclipse.linuxtools.oprofile.core.opxml.checkevent,
+ org.eclipse.linuxtools.oprofile.core.opxml.info,
+ org.eclipse.linuxtools.oprofile.core.opxml.modeldata,
+ org.eclipse.linuxtools.oprofile.core.opxml.sessions,
+ org.eclipse.linuxtools.oprofile.tests
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/build.properties
new file mode 100644
index 0000000000..0785092212
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/build.properties
@@ -0,0 +1,14 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ resources/,\
+ plugin.properties,\
+ test.xml
+src.includes = src/,\
+ resources/,\
+ plugin.properties,\
+ build.properties,\
+ META-INF/,\
+ test.xml
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/plugin.properties
new file mode 100644
index 0000000000..89afb561dd
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/plugin.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# Copyright (c) 2009 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Core Tests Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_counter.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_counter.xml
new file mode 100644
index 0000000000..0d95acc0f7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_counter.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<check-events>
+ <result>invalid-counter</result>
+</check-events> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_event.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_event.xml
new file mode 100644
index 0000000000..a71f74558b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_event.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<check-events>
+ <result>invalid-event</result>
+</check-events> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_umask.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_umask.xml
new file mode 100644
index 0000000000..126fd38be0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_invalid_umask.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<check-events>
+ <result>invalid-um</result>
+</check-events> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_ok.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_ok.xml
new file mode 100644
index 0000000000..7f6c9a9f80
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_check-event_ok.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<check-events>
+ <result>ok</result>
+</check-events> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info.xml
new file mode 100644
index 0000000000..022a5d9793
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<info>
+ <num-counters>2</num-counters>
+ <cpu-frequency>800</cpu-frequency>
+ <defaults>
+ <sample-dir>/var/lib/oprofile/samples/</sample-dir>
+ <lock-file>/var/lib/oprofile/lock</lock-file>
+ <log-file>/var/lib/oprofile/samples/oprofiled.log</log-file>
+ <dump-status>/var/lib/oprofile/complete_dump</dump-status>
+ </defaults>
+ <timer-mode>true</timer-mode>
+ <event-list counter="0">
+ <event>
+ <name>CPU_CLK_UNHALTED</name>
+ <description>Clock cycles when not halted</description>
+ <value>60</value>
+ <minimum>6000</minimum>
+ <unit-mask>
+ <type>exclusive</type>
+ <default>0</default>
+ <mask>
+ <value>0</value>
+ <description>Unhalted core cycles</description>
+ </mask>
+ <mask>
+ <value>1</value>
+ <description>Unhalted bus cycles</description>
+ </mask>
+ <mask>
+ <value>2</value>
+ <description>Unhalted bus cycles of this core while the other core is halted</description>
+ </mask>
+ </unit-mask>
+ </event>
+ <event>
+ <name>INST_RETIRED_ANY_P</name>
+ <description>number of instructions retired</description>
+ <value>192</value>
+ <minimum>6000</minimum>
+ <unit-mask>
+ <type>mandatory</type>
+ <default>0</default>
+ <mask>
+ <value>0</value>
+ <description>No unit mask</description>
+ </mask>
+ </unit-mask>
+ </event>
+ <event>
+ <name>DTLB_MISSES</name>
+ <description>DTLB miss events</description>
+ <value>8</value>
+ <minimum>500</minimum>
+ <unit-mask>
+ <type>bitmask</type>
+ <default>15</default>
+ <mask>
+ <value>1</value>
+ <description>ANY Memory accesses that missed the DTLB.</description>
+ </mask>
+ <mask>
+ <value>2</value>
+ <description>MISS_LD DTLB misses due to load operations.</description>
+ </mask>
+ <mask>
+ <value>4</value>
+ <description>L0_MISS_LD L0 DTLB misses due to load operations.</description>
+ </mask>
+ <mask>
+ <value>8</value>
+ <description>MISS_ST TLB misses due to store operations.</description>
+ </mask>
+ </unit-mask>
+ </event>
+ </event-list>
+ <event-list counter="1">
+ <event>
+ <name>L2_M_LINES_IN</name>
+ <description>number of modified lines allocated in L2</description>
+ <value>37</value>
+ <minimum>500</minimum>
+ <unit-mask>
+ <type>exclusive</type>
+ <default>64</default>
+ <mask>
+ <value>192</value>
+ <description>All cores</description>
+ </mask>
+ <mask>
+ <value>64</value>
+ <description>This core</description>
+ </mask>
+ </unit-mask>
+ </event>
+ <event>
+ <name>L2_LINES_OUT</name>
+ <description>number of recovered lines from L2</description>
+ <value>38</value>
+ <minimum>500</minimum>
+ <unit-mask>
+ <type>bitmask</type>
+ <default>112</default>
+ <mask>
+ <value>192</value>
+ <description>core: all cores</description>
+ </mask>
+ <mask>
+ <value>64</value>
+ <description>core: this core</description>
+ </mask>
+ <mask>
+ <value>48</value>
+ <description>prefetch: all inclusive</description>
+ </mask>
+ <mask>
+ <value>16</value>
+ <description>prefetch: Hardware prefetch only</description>
+ </mask>
+ <mask>
+ <value>0</value>
+ <description>prefetch: exclude hardware prefetch</description>
+ </mask>
+ </unit-mask>
+ </event>
+ <event>
+ <name>EIST_TRANS_ALL</name>
+ <description>Intel(tm) Enhanced SpeedStep(r) Technology transitions</description>
+ <value>58</value>
+ <minimum>500</minimum>
+ <unit-mask>
+ <type>notavalidtype</type>
+ <default>1</default>
+ <mask>
+ <value>1</value>
+ <description>No unit mask</description>
+ </mask>
+ </unit-mask>
+ </event>
+ </event-list>
+</info> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info_0ctrs.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info_0ctrs.xml
new file mode 100644
index 0000000000..c7dac5069d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_info_0ctrs.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<info>
+ <num-counters>error</num-counters>
+</info> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data.xml
new file mode 100644
index 0000000000..8292083ae6
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model-data>
+ <image name="/test/path/for/image" count="205000">
+ <symbols>
+ <symbol name="TestFunction1(int)" file="/test/path/for/src/image.cpp" count="180000">
+ <sample>
+ <count>130000</count>
+ <line>42</line>
+ </sample>
+ <sample>
+ <count>40000</count>
+ <line>36</line>
+ </sample>
+ <sample>
+ <count>9999</count>
+ <line>31</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>39</line>
+ </sample>
+ </symbol>
+ <symbol name="TestFunction2(int, int)" file="/test/path/for/src/image2.cpp" count="20000">
+ <sample>
+ <count>19998</count>
+ <line>94</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>12</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>55</line>
+ </sample>
+ </symbol>
+ </symbols>
+ <dependent count="5000">
+ <image name="/no-vmlinux" count="4400">
+ </image>
+ <image name="/lib64/ld-2.9.so" count="300">
+ <symbols>
+ <symbol name="do_lookup_x" file="dl-lookup.c" count="299">
+ <sample>
+ <count>299</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_unload_cache" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/usr/lib64/libstdc++.so.6.0.10" count="160">
+ </image>
+ <image name="/lib64/libc-2.9.so" count="140">
+ <symbols>
+ <symbol name="_IO_new_file_seekoff" file="" count="100">
+ <sample>
+ <count>100</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="bool std::operator!=&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;, char const*)" file="" count="40">
+ <sample>
+ <count>40</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ </dependent>
+ </image>
+</model-data> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data_multiple_image.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data_multiple_image.xml
new file mode 100644
index 0000000000..e82dad5077
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_model-data_multiple_image.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model-data>
+ <image name="/no-vmlinux" count="6844">
+ </image>
+ <image name="/bin/grep" count="2">
+ </image>
+ <image name="/bin/gawk" count="8">
+ </image>
+ <image name="/bin/bash" count="142">
+ </image>
+ <image name="/lib64/libgobject-2.0.so.0.1800.3" count="61">
+ </image>
+ <image name="/lib64/libgio-2.0.so.0.1800.3" count="2">
+ </image>
+ <image name="/lib64/libdl-2.9.so" count="2">
+ <symbols>
+ <symbol name="__do_global_dtors_aux" file="crtstuff.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/ld-2.9.so" count="36">
+ <symbols>
+ <symbol name="_dl_start" file="rtld.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="dl_main" file="rtld.c" count="3">
+ <sample>
+ <count>3</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="init_tls" file="rtld.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="open_verify" file="dl-load.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_setup_hash" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_init_internal" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_important_hwcaps" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="munmap" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_load_cache_lookup" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_fini" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__GI_memset" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_init_paths" file="rawmemchr.c" count="3">
+ <sample>
+ <count>3</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__brk" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_name_match_p" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="index" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_resolve_conflicts" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_cache_libcmp" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="strcmp" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_start_user" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="strlen" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_sort_fini" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_map_object_deps" file="rawmemchr.c" count="4">
+ <sample>
+ <count>4</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__libc_memalign" file="" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/libdbus-1.so.3.4.0" count="10">
+ </image>
+ <image name="/lib64/libfuse.so.2.7.4" count="1">
+ </image>
+ <image name="/lib64/libm-2.9.so" count="2">
+ <symbols>
+ <symbol name="__dubsin" file="interp.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/libglib-2.0.so.0.1800.3" count="107">
+ </image>
+ <image name="/lib64/libgthread-2.0.so.0.1800.3" count="3">
+ </image>
+ <image name="/usr/bin/which" count="1">
+ </image>
+ <image name="/usr/bin/compiz" count="21">
+ </image>
+ <image name="/usr/bin/Xorg" count="154">
+ <dependent count="6">
+ <image name="[vdso]" count="6">
+ </image>
+ </dependent>
+ </image>
+ <image name="/usr/bin/ophelp" count="11">
+ </image>
+ <image name="/usr/bin/qemu-kvm" count="142">
+ <dependent count="1">
+ <image name="[vdso]" count="1">
+ </image>
+ </dependent>
+ </image>
+ <image name="/usr/bin/oprofiled" count="26">
+ </image>
+ <image name="/usr/sbin/libvirtd" count="3">
+ </image>
+ <image name="/usr/libexec/multiload-applet-2" count="1">
+ </image>
+ <image name="/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server/libjvm.so" count="7">
+ </image>
+ <image name="/usr/lib64/libgtk-x11-2.0.so.0.1400.5" count="22">
+ </image>
+ <image name="/usr/lib64/libpangocairo-1.0.so.0.2203.0" count="4">
+ </image>
+ <image name="/usr/lib64/libXrender.so.1.3.0" count="2">
+ </image>
+</model-data> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_sessions.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_sessions.xml
new file mode 100644
index 0000000000..2c3016ddde
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/resources/test_sessions.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sessions>
+ <event name="BR_INST_EXEC">
+ <session name="current">
+ </session>
+ </event>
+ <event name="CPU_CLK_UNHALTED">
+ <session name="saved">
+ </session>
+ </event>
+ <event name="UOPS_RETIRED">
+ <session name="current">
+ </session>
+ <session name="&quot;&lt;&gt;&amp;&apos;">
+ </session>
+ </event>
+</sessions>
+ \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java
new file mode 100644
index 0000000000..f89f6aa5fd
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/AllCoreTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllCoreTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.eclipse.linuxtools.oprofile.core.tests"); //$NON-NLS-1$
+
+ suite.addTestSuite(TestModelDataParse.class);
+ suite.addTestSuite(TestSessionsParse.class);
+ suite.addTestSuite(TestCheckEventsParse.class);
+ suite.addTestSuite(TestInfoParse.class);
+ suite.addTestSuite(TestDataModel.class);
+
+ return suite;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java
new file mode 100644
index 0000000000..dfc0de866f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/CoreTestsPlugin.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CoreTestsPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static CoreTestsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CoreTestsPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CoreTestsPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestCheckEventsParse.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestCheckEventsParse.java
new file mode 100644
index 0000000000..71fe76c4c9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestCheckEventsParse.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import java.io.FileReader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.checkevent.CheckEventsProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class TestCheckEventsParse extends TestCase {
+ private static final String REL_PATH_TO_TEST_XML_OK = "resources/test_check-event_ok.xml"; //$NON-NLS-1$
+ private static final String REL_PATH_TO_TEST_XML_INVALID_EVENT = "resources/test_check-event_invalid_event.xml"; //$NON-NLS-1$
+ private static final String REL_PATH_TO_TEST_XML_INVALID_UMASK = "resources/test_check-event_invalid_umask.xml"; //$NON-NLS-1$
+ private static final String REL_PATH_TO_TEST_XML_INVALID_COUNTER = "resources/test_check-event_invalid_counter.xml"; //$NON-NLS-1$
+ private int[] test_ok, test_invalid_event, test_invalid_umask, test_invalid_counter;
+
+ public TestCheckEventsParse() {
+ super("test check-event parsers"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ test_ok = new int[1];
+ setUpHelper(REL_PATH_TO_TEST_XML_OK, test_ok);
+ test_invalid_event = new int[1];
+ setUpHelper(REL_PATH_TO_TEST_XML_INVALID_EVENT, test_invalid_event);
+ test_invalid_umask = new int[1];
+ setUpHelper(REL_PATH_TO_TEST_XML_INVALID_UMASK, test_invalid_umask);
+ test_invalid_counter = new int[1];
+ setUpHelper(REL_PATH_TO_TEST_XML_INVALID_COUNTER, test_invalid_counter);
+ }
+
+ //helper
+ private void setUpHelper(String fileToParse, final int[] resultArray) throws Exception {
+ /* this code mostly taken from OpxmlRunner */
+ XMLReader reader = null;
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(resultArray);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(fileToParse), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ }
+
+ public void testParse() {
+ assertEquals(CheckEventsProcessor.EVENT_OK, test_ok[0]);
+ assertEquals(CheckEventsProcessor.INVALID_EVENT, test_invalid_event[0]);
+ assertEquals(CheckEventsProcessor.INVALID_UMASK, test_invalid_umask[0]);
+ assertEquals(CheckEventsProcessor.INVALID_COUNTER, test_invalid_counter[0]);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDataModel.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDataModel.java
new file mode 100644
index 0000000000..c50573eff9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestDataModel.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.tests.TestingOpModelRoot;
+
+public class TestDataModel extends TestCase {
+ private TestingOpModelRoot _testRoot;
+
+ public TestDataModel() {
+ super("test data model"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ _testRoot = new TestingOpModelRoot();
+ _testRoot.refreshModel();
+ }
+
+ public void testParse() {
+ OpModelEvent[] events = _testRoot.getEvents();
+ assertEquals(3, events.length);
+ assertEquals(TestingOpModelRoot.NAME_E1, events[0].getName());
+ assertEquals(TestingOpModelRoot.NAME_E2, events[1].getName());
+
+ OpModelSession[] e1_sessions = events[0].getSessions(), e2_sessions = events[1].getSessions();
+ assertEquals(1, e1_sessions.length);
+ assertEquals(4, e2_sessions.length);
+
+ assertEquals(205000, e1_sessions[0].getCount());
+ assertEquals(205000, e2_sessions[0].getCount());
+ assertEquals(200000, e2_sessions[1].getCount());
+ assertEquals(OpModelImage.IMAGE_PARSE_ERROR, e2_sessions[2].getCount());
+ assertEquals(0, e2_sessions[3].getCount());
+
+ assertEquals(TestingOpModelRoot.NAME_E1_S1, e1_sessions[0].getName());
+ assertEquals(TestingOpModelRoot.NAME_E2_S1, e2_sessions[0].getName());
+ assertEquals(TestingOpModelRoot.NAME_E2_S2, e2_sessions[1].getName());
+ assertEquals(TestingOpModelRoot.NAME_E2_S3, e2_sessions[2].getName());
+ assertEquals(TestingOpModelRoot.NAME_E2_S4, e2_sessions[3].getName());
+
+ //further image parsing is tested in the TestModelDataParse testParse
+ }
+
+ public void testStringOutput() {
+ assertEquals(TestingOpModelRoot.ROOT_OUTPUT, _testRoot.toString());
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestInfoParse.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestInfoParse.java
new file mode 100644
index 0000000000..f962b31bf7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestInfoParse.java
@@ -0,0 +1,418 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import java.io.FileReader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class TestInfoParse extends TestCase {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_info.xml"; //$NON-NLS-1$
+ private static final String REL_PATH_TO_TEST_XML_0CTR = "resources/test_info_0ctrs.xml"; //$NON-NLS-1$
+
+ private OpInfo info;
+ private OpInfo info_0ctr;
+
+
+ public TestInfoParse() {
+ super("test info parsers"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ /* this code mostly taken from OpxmlRunner */
+ XMLReader reader = null;
+ info = new OpInfo();
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(info);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+
+ info_0ctr = new OpInfo();
+ handler = OprofileSAXHandler.getInstance(info_0ctr);
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML_0CTR), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ }
+
+ public void testParse() {
+ assertEquals("/var/lib/oprofile/samples/", info.getDefault(OpInfo.DEFAULT_SAMPLE_DIR)); //$NON-NLS-1$
+ assertEquals("/var/lib/oprofile/lock", info.getDefault(OpInfo.DEFAULT_LOCK_FILE)); //$NON-NLS-1$
+ assertEquals("/var/lib/oprofile/samples/oprofiled.log", info.getDefault(OpInfo.DEFAULT_LOG_FILE)); //$NON-NLS-1$
+ assertEquals("/var/lib/oprofile/complete_dump", info.getDefault(OpInfo.DEFAULT_DUMP_STATUS)); //$NON-NLS-1$
+ assertTrue(info.getTimerMode());
+
+ assertEquals((double)800, info.getCPUSpeed());
+ assertEquals(2, info.getNrCounters());
+
+ OpEvent[] ctr0_events = info.getEvents(0), ctr1_events = info.getEvents(1);
+ assertEquals(3, ctr0_events.length);
+ assertEquals(3, ctr1_events.length);
+
+ OpEvent ctr0_e1 = ctr0_events[0], ctr0_e2 = ctr0_events[1], ctr0_e3 = ctr0_events[2],
+ ctr1_e1 = ctr1_events[0], ctr1_e2 = ctr1_events[1], ctr1_e3 = ctr1_events[2];
+ //events must be ordered alphabetically
+ assertEquals(6000, ctr0_e1.getMinCount());
+ assertEquals(60, ctr0_e1.getNumber());
+ assertEquals("CPU_CLK_UNHALTED", ctr0_e1.getText()); //$NON-NLS-1$
+ assertEquals("Clock cycles when not halted", ctr0_e1.getTextDescription()); //$NON-NLS-1$
+ assertEquals(500, ctr0_e2.getMinCount());
+ assertEquals(8, ctr0_e2.getNumber());
+ assertEquals("DTLB_MISSES", ctr0_e2.getText()); //$NON-NLS-1$
+ assertEquals("DTLB miss events", ctr0_e2.getTextDescription()); //$NON-NLS-1$
+ assertEquals(6000, ctr0_e3.getMinCount());
+ assertEquals(192, ctr0_e3.getNumber());
+ assertEquals("INST_RETIRED_ANY_P", ctr0_e3.getText()); //$NON-NLS-1$
+ assertEquals("number of instructions retired", ctr0_e3.getTextDescription()); //$NON-NLS-1$
+ assertEquals(500, ctr1_e1.getMinCount());
+ assertEquals(58, ctr1_e1.getNumber());
+ assertEquals("EIST_TRANS_ALL", ctr1_e1.getText()); //$NON-NLS-1$
+ assertEquals("Intel(tm) Enhanced SpeedStep(r) Technology transitions", ctr1_e1.getTextDescription()); //$NON-NLS-1$
+ assertEquals(500, ctr1_e2.getMinCount());
+ assertEquals(38, ctr1_e2.getNumber());
+ assertEquals("L2_LINES_OUT", ctr1_e2.getText()); //$NON-NLS-1$
+ assertEquals("number of recovered lines from L2", ctr1_e2.getTextDescription()); //$NON-NLS-1$
+ assertEquals(500, ctr1_e3.getMinCount());
+ assertEquals(37, ctr1_e3.getNumber());
+ assertEquals("L2_M_LINES_IN", ctr1_e3.getText()); //$NON-NLS-1$
+ assertEquals("number of modified lines allocated in L2", ctr1_e3.getTextDescription()); //$NON-NLS-1$
+
+ OpUnitMask ctr0_e1_mask = ctr0_e1.getUnitMask(), ctr0_e2_mask = ctr0_e2.getUnitMask(),
+ ctr0_e3_mask = ctr0_e3.getUnitMask(), ctr1_e1_mask = ctr1_e1.getUnitMask(),
+ ctr1_e2_mask = ctr1_e2.getUnitMask(), ctr1_e3_mask = ctr1_e3.getUnitMask();
+
+ assertEquals(0, ctr0_e1_mask.getMaskValue());
+ assertEquals(OpUnitMask.EXCLUSIVE, ctr0_e1_mask.getType());
+ assertEquals(3, ctr0_e1_mask.getNumMasks());
+ assertEquals(0, ctr0_e1_mask.getMaskFromIndex(0));
+ assertEquals("Unhalted core cycles", ctr0_e1_mask.getText(0)); //$NON-NLS-1$
+ assertEquals(1, ctr0_e1_mask.getMaskFromIndex(1));
+ assertEquals("Unhalted bus cycles", ctr0_e1_mask.getText(1)); //$NON-NLS-1$
+ assertEquals(2, ctr0_e1_mask.getMaskFromIndex(2));
+ assertEquals("Unhalted bus cycles of this core while the other core is halted", ctr0_e1_mask.getText(2)); //$NON-NLS-1$
+
+ assertEquals(15, ctr0_e2_mask.getMaskValue());
+ assertEquals(OpUnitMask.BITMASK, ctr0_e2_mask.getType());
+ assertEquals(4, ctr0_e2_mask.getNumMasks());
+ assertEquals(1, ctr0_e2_mask.getMaskFromIndex(0));
+ assertEquals("ANY Memory accesses that missed the DTLB.", ctr0_e2_mask.getText(0)); //$NON-NLS-1$
+ assertEquals(2, ctr0_e2_mask.getMaskFromIndex(1));
+ assertEquals("MISS_LD DTLB misses due to load operations.", ctr0_e2_mask.getText(1)); //$NON-NLS-1$
+ assertEquals(4, ctr0_e2_mask.getMaskFromIndex(2));
+ assertEquals("L0_MISS_LD L0 DTLB misses due to load operations.", ctr0_e2_mask.getText(2)); //$NON-NLS-1$
+ assertEquals(8, ctr0_e2_mask.getMaskFromIndex(3));
+ assertEquals("MISS_ST TLB misses due to store operations.", ctr0_e2_mask.getText(3)); //$NON-NLS-1$
+
+ assertEquals(0, ctr0_e3_mask.getMaskValue());
+ assertEquals(OpUnitMask.MANDATORY, ctr0_e3_mask.getType());
+ assertEquals(1, ctr0_e3_mask.getNumMasks());
+ assertEquals(0, ctr0_e3_mask.getMaskFromIndex(0));
+ assertEquals("No unit mask", ctr0_e3_mask.getText(0)); //$NON-NLS-1$
+
+ assertEquals(1, ctr1_e1_mask.getMaskValue());
+ assertEquals(OpUnitMask.INVALID, ctr1_e1_mask.getType());
+ assertEquals(1, ctr1_e1_mask.getNumMasks());
+ assertEquals(-1, ctr1_e1_mask.getMaskFromIndex(0)); //-1 because of invalid mask type
+ assertEquals("No unit mask", ctr1_e1_mask.getText(0)); //$NON-NLS-1$
+
+ assertEquals(112, ctr1_e2_mask.getMaskValue());
+ assertEquals(OpUnitMask.BITMASK, ctr1_e2_mask.getType());
+ assertEquals(5, ctr1_e2_mask.getNumMasks());
+ assertEquals(192, ctr1_e2_mask.getMaskFromIndex(0));
+ assertEquals("core: all cores", ctr1_e2_mask.getText(0)); //$NON-NLS-1$
+ assertEquals(64, ctr1_e2_mask.getMaskFromIndex(1));
+ assertEquals("core: this core", ctr1_e2_mask.getText(1)); //$NON-NLS-1$
+ assertEquals(48, ctr1_e2_mask.getMaskFromIndex(2));
+ assertEquals("prefetch: all inclusive", ctr1_e2_mask.getText(2)); //$NON-NLS-1$
+ assertEquals(16, ctr1_e2_mask.getMaskFromIndex(3));
+ assertEquals("prefetch: Hardware prefetch only", ctr1_e2_mask.getText(3)); //$NON-NLS-1$
+ assertEquals(0, ctr1_e2_mask.getMaskFromIndex(4));
+ assertEquals("prefetch: exclude hardware prefetch", ctr1_e2_mask.getText(4)); //$NON-NLS-1$
+
+ assertEquals(64, ctr1_e3_mask.getMaskValue());
+ assertEquals(OpUnitMask.EXCLUSIVE, ctr1_e3_mask.getType());
+ assertEquals(2, ctr1_e3_mask.getNumMasks());
+ assertEquals(192, ctr1_e3_mask.getMaskFromIndex(0));
+ assertEquals("All cores", ctr1_e3_mask.getText(0)); //$NON-NLS-1$
+ assertEquals(64, ctr1_e3_mask.getMaskFromIndex(1));
+ assertEquals("This core", ctr1_e3_mask.getText(1)); //$NON-NLS-1$
+
+ assertNull(ctr0_e1_mask.getText(-1));
+
+ assertEquals(0, info_0ctr.getNrCounters());
+ }
+
+ public void testUnitMask() throws Exception {
+ //test types of masks setting/unsetting
+ OpUnitMask mask_bit1 = info.getEvents(0)[1].getUnitMask(),
+// mask_bit2 = info.getEvents(1)[1].getUnitMask(),
+ mask_exl = info.getEvents(0)[0].getUnitMask(),
+ mask_mand = info.getEvents(0)[2].getUnitMask(),
+ mask_invalid = info.getEvents(1)[0].getUnitMask();
+
+ //bitmask 1 test -- bitmasks all mutually exclusive
+ assertEquals(15, mask_bit1.getMaskValue());
+ mask_bit1.setMaskValue(0);
+ mask_bit1.setMaskFromIndex(0);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(1, mask_bit1.getMaskValue());
+
+ mask_bit1.setMaskFromIndex(1);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(3, mask_bit1.getMaskValue());
+
+ mask_bit1.setMaskFromIndex(2);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(7, mask_bit1.getMaskValue());
+
+ mask_bit1.setMaskFromIndex(3);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(15, mask_bit1.getMaskValue());
+
+ mask_bit1.unSetMaskFromIndex(1);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(3));
+
+ mask_bit1.unSetMaskFromIndex(2);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(3));
+
+ mask_bit1.unSetMaskFromIndex(3);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+
+ mask_bit1.setMaskFromIndex(2);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(5, mask_bit1.getMaskValue());
+
+ mask_bit1.unSetMaskFromIndex(1);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+
+ mask_bit1.unSetMaskFromIndex(3);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(5, mask_bit1.getMaskValue());
+
+ mask_bit1.setMaskFromIndex(2);
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(0));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(1));
+ assertEquals(true, mask_bit1.isMaskSetFromIndex(2));
+ assertEquals(false, mask_bit1.isMaskSetFromIndex(3));
+ assertEquals(5, mask_bit1.getMaskValue());
+
+ mask_bit1.setMaskValue(OpUnitMask.SET_DEFAULT_MASK);
+ assertEquals(15, mask_bit1.getMaskValue());
+
+ //bitmask 2 test -- bitmasks overlap
+ /* bug related to overlapping bitmasks eclipse bz 261917 */
+// assertEquals(112, mask_bit2.getMaskValue());
+// mask_bit2.setMaskValue(0);
+// mask_bit2.setMaskFromIndex(0);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(192, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskFromIndex(1);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(3, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskFromIndex(2);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(7, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskFromIndex(3);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(15, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskFromIndex(4);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(15, mask_bit2.getMaskValue());
+//
+// mask_bit2.unSetMaskFromIndex(1);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(4));
+//
+// mask_bit2.unSetMaskFromIndex(2);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(4));
+//
+// mask_bit2.unSetMaskFromIndex(3);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(4));
+//
+// mask_bit2.unSetMaskFromIndex(4);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//
+// mask_bit2.setMaskFromIndex(2);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(5, mask_bit2.getMaskValue());
+//
+// mask_bit2.unSetMaskFromIndex(1);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//
+// mask_bit2.unSetMaskFromIndex(3);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(5, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskFromIndex(2);
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(0));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(1));
+// assertEquals(true, mask_bit2.isMaskSetFromIndex(2));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(3));
+// assertEquals(false, mask_bit2.isMaskSetFromIndex(4));
+//// assertEquals(5, mask_bit2.getMaskValue());
+//
+// mask_bit2.setMaskValue(OpUnitMask.SET_DEFAULT_MASK);
+// assertEquals(112, mask_bit2.getMaskValue());
+
+
+ //exclusive test
+ assertEquals(0, mask_exl.getMaskValue());
+ assertEquals(true, mask_exl.isMaskSetFromIndex(0));
+ assertEquals(false, mask_exl.isMaskSetFromIndex(1));
+ assertEquals(false, mask_exl.isMaskSetFromIndex(2));
+ mask_exl.setMaskFromIndex(1);
+ assertEquals(false, mask_exl.isMaskSetFromIndex(0));
+ assertEquals(1, mask_exl.getMaskValue());
+ mask_exl.unSetMaskFromIndex(1);
+ assertEquals(1, mask_exl.getMaskValue());
+ mask_exl.setMaskFromIndex(2);
+ assertEquals(2, mask_exl.getMaskValue());
+ mask_exl.setDefaultMaskValue();
+ assertEquals(0, mask_exl.getMaskValue());
+
+
+ //mandatory test
+ assertEquals(0, mask_mand.getMaskValue());
+ assertEquals(false, mask_mand.isMaskSetFromIndex(0));
+ mask_mand.setMaskFromIndex(0);
+ assertEquals(0, mask_mand.getMaskValue());
+ mask_mand.unSetMaskFromIndex(0);
+ assertEquals(0, mask_mand.getMaskValue());
+ mask_mand.setMaskValue(10);
+ mask_mand.setDefaultMaskValue();
+ assertEquals(0, mask_mand.getMaskValue());
+
+ //invalid test
+ assertEquals(1, mask_invalid.getMaskValue());
+ assertEquals(false, mask_invalid.isMaskSetFromIndex(0));
+ mask_invalid.setMaskFromIndex(0);
+ assertEquals(1, mask_invalid.getMaskValue());
+ mask_invalid.unSetMaskFromIndex(0);
+ assertEquals(1, mask_invalid.getMaskValue());
+ mask_invalid.setMaskValue(0);
+ mask_invalid.setDefaultMaskValue();
+ assertEquals(1, mask_invalid.getMaskValue());
+ }
+
+ public void testInfo() throws Exception {
+ OpEvent[] result = info.getEvents(-1);
+ assertEquals(0, result.length);
+
+ assertNull(info.findEvent("doesnt exist")); //$NON-NLS-1$
+
+ OpEvent event = info.findEvent("CPU_CLK_UNHALTED"); //$NON-NLS-1$
+ assertEquals("CPU_CLK_UNHALTED", event.getText()); //$NON-NLS-1$
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestModelDataParse.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestModelDataParse.java
new file mode 100644
index 0000000000..6311d7d6a0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestModelDataParse.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import java.io.FileReader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSample;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSymbol;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class TestModelDataParse extends TestCase {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_model-data.xml"; //$NON-NLS-1$
+ private static final String REL_PATH_TO_TEST_XML_MULTI_IMAGE = "resources/test_model-data_multiple_image.xml"; //$NON-NLS-1$
+ private static final String IMAGE_OUTPUT = "/test/path/for/image, Count: 205000, Dependent Count: 5000\nSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\tSample: Line #: 42, Count: 130000\n\tSample: Line #: 36, Count: 40000\n\tSample: Line #: 31, Count: 9999\n\tSample: Line #: 39, Count: 1\nSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\tSample: Line #: 94, Count: 19998\n\tSample: Line #: 12, Count: 1\n\tSample: Line #: 55, Count: 1\nDependent Image: /no-vmlinux, Count: 4400\nDependent Image: /lib64/ld-2.9.so, Count: 300\n\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\tSample: Line #: 0, Count: 299\n\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\tSample: Line #: 0, Count: 1\nDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\nDependent Image: /lib64/libc-2.9.so, Count: 140\n\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\tSample: Line #: 0, Count: 100\n\tSymbols: bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*), File: , Count: 40\n\t\tSample: Line #: 0, Count: 40\n"; //$NON-NLS-1$
+ private static final String IMAGE_OUTPUT_WITHTAB = "/test/path/for/image, Count: 205000, Dependent Count: 5000\n\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\tSample: Line #: 42, Count: 130000\n\t\tSample: Line #: 36, Count: 40000\n\t\tSample: Line #: 31, Count: 9999\n\t\tSample: Line #: 39, Count: 1\n\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\tSample: Line #: 94, Count: 19998\n\t\tSample: Line #: 12, Count: 1\n\t\tSample: Line #: 55, Count: 1\n\tDependent Image: /no-vmlinux, Count: 4400\n\tDependent Image: /lib64/ld-2.9.so, Count: 300\n\t\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\t\tSample: Line #: 0, Count: 299\n\t\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\t\tSample: Line #: 0, Count: 1\n\tDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\n\tDependent Image: /lib64/libc-2.9.so, Count: 140\n\t\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\t\tSample: Line #: 0, Count: 100\n\t\tSymbols: bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*), File: , Count: 40\n\t\t\tSample: Line #: 0, Count: 40\n"; //$NON-NLS-1$
+
+ private OpModelImage parsedImage;
+ private OpModelImage parsedErrorImage;
+
+ public TestModelDataParse() {
+ super("test model-data parsers"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ /* this code mostly taken from OpxmlRunner */
+ XMLReader reader = null;
+ parsedImage = new OpModelImage();
+ ModelDataProcessor.CallData image = new ModelDataProcessor.CallData(parsedImage);
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(image);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+
+ //2nd test image
+ parsedErrorImage = new OpModelImage();
+ ModelDataProcessor.CallData errorImage = new ModelDataProcessor.CallData(parsedErrorImage);
+ handler = OprofileSAXHandler.getInstance(errorImage);
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML_MULTI_IMAGE), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ }
+
+ public void testParse() {
+ //test attributes
+ assertEquals("/test/path/for/image", parsedImage.getName()); //$NON-NLS-1$
+ assertEquals(205000, parsedImage.getCount());
+
+ //test symbols
+ OpModelSymbol[] symbols = parsedImage.getSymbols();
+ assertEquals(2, symbols.length);
+ OpModelSymbol sym1 = symbols[0], sym2 = symbols[1];
+ assertEquals("TestFunction1(int)", sym1.getName()); //$NON-NLS-1$
+ assertEquals("/test/path/for/src/image.cpp", sym1.getFile()); //$NON-NLS-1$
+ assertEquals(180000, sym1.getCount());
+ assertEquals("TestFunction2(int, int)", sym2.getName()); //$NON-NLS-1$
+ assertEquals("/test/path/for/src/image2.cpp", sym2.getFile()); //$NON-NLS-1$
+ assertEquals(20000, sym2.getCount());
+
+ //test samples
+ OpModelSample[] sym1_spls = sym1.getSamples(), sym2_spls = sym2.getSamples();
+ assertEquals(4, sym1_spls.length);
+ assertEquals(3, sym2_spls.length);
+ OpModelSample sym1_spl1 = sym1_spls[0], sym1_spl2 = sym1_spls[1], sym1_spl3 = sym1_spls[2], sym1_spl4 = sym1_spls[3];
+ OpModelSample sym2_spl1 = sym2_spls[0], sym2_spl2 = sym2_spls[1], sym2_spl3 = sym2_spls[2];
+ assertEquals(130000, sym1_spl1.getCount());
+ assertEquals(42, sym1_spl1.getLine());
+ assertEquals(40000, sym1_spl2.getCount());
+ assertEquals(36, sym1_spl2.getLine());
+ assertEquals(9999, sym1_spl3.getCount());
+ assertEquals(31, sym1_spl3.getLine());
+ assertEquals(1, sym1_spl4.getCount());
+ assertEquals(39, sym1_spl4.getLine());
+ assertEquals(19998, sym2_spl1.getCount());
+ assertEquals(94, sym2_spl1.getLine());
+ assertEquals(1, sym2_spl2.getCount());
+ assertEquals(12, sym2_spl2.getLine());
+ assertEquals(1, sym2_spl3.getCount());
+ assertEquals(55, sym2_spl3.getLine());
+
+ //test dependent images
+ assertEquals(true, parsedImage.hasDependents());
+ assertEquals(5000, parsedImage.getDepCount());
+ OpModelImage[] deps = parsedImage.getDependents();
+ assertEquals(4, deps.length);
+ OpModelImage dep1 = deps[0], dep2 = deps[1], dep3 = deps[2], dep4 = deps[3];
+
+ assertEquals(false, dep1.hasDependents());
+ assertEquals("/no-vmlinux", dep1.getName()); //$NON-NLS-1$
+ assertEquals(4400, dep1.getCount());
+
+ assertEquals(false, dep2.hasDependents());
+ OpModelSymbol[] dep2_syms = dep2.getSymbols();
+ assertEquals(2, dep2_syms.length);
+ OpModelSymbol dep2_sym1 = dep2_syms[0], dep2_sym2 = dep2_syms[1];
+ OpModelSample[] dep2_sym1_spls = dep2_sym1.getSamples(), dep2_sym2_spls = dep2_sym2.getSamples();
+ assertEquals(1, dep2_sym1_spls.length);
+ assertEquals(1, dep2_sym2_spls.length);
+ OpModelSample dep2_sym1_spl1 = dep2_sym1_spls[0], dep2_sym2_spl1 = dep2_sym2_spls[0];
+ assertEquals("/lib64/ld-2.9.so", dep2.getName()); //$NON-NLS-1$
+ assertEquals(300, dep2.getCount());
+ assertEquals("do_lookup_x", dep2_sym1.getName()); //$NON-NLS-1$
+ assertEquals("dl-lookup.c", dep2_sym1.getFile()); //$NON-NLS-1$
+ assertEquals(299, dep2_sym1.getCount());
+ assertEquals(299, dep2_sym1_spl1.getCount());
+ assertEquals(0, dep2_sym1_spl1.getLine());
+ assertEquals("_dl_unload_cache", dep2_sym2.getName()); //$NON-NLS-1$
+ assertEquals("rawmemchr.c", dep2_sym2.getFile()); //$NON-NLS-1$
+ assertEquals(1, dep2_sym2.getCount());
+ assertEquals(1, dep2_sym2_spl1.getCount());
+ assertEquals(0, dep2_sym2_spl1.getLine());
+
+ assertEquals(false, dep3.hasDependents());
+ assertEquals("/usr/lib64/libstdc++.so.6.0.10", dep3.getName()); //$NON-NLS-1$
+ assertEquals(160, dep3.getCount());
+
+ assertEquals(false, dep4.hasDependents());
+ OpModelSymbol[] dep4_syms = dep4.getSymbols();
+ assertEquals(2, dep4_syms.length);
+ OpModelSymbol dep4_sym1 = dep4_syms[0], dep4_sym2 = dep4_syms[1];
+ OpModelSample[] dep4_sym1_spls = dep4_sym1.getSamples(), dep4_sym2_spls = dep4_sym2.getSamples();
+ assertEquals(1, dep4_sym1_spls.length);
+ assertEquals(1, dep4_sym2_spls.length);
+ OpModelSample dep4_sym1_spl1 = dep4_sym1_spls[0], dep4_sym2_spl1 = dep4_sym2_spls[0];
+ assertEquals("/lib64/libc-2.9.so", dep4.getName()); //$NON-NLS-1$
+ assertEquals(140, dep4.getCount());
+ assertEquals("_IO_new_file_seekoff", dep4_sym1.getName()); //$NON-NLS-1$
+ assertEquals("", dep4_sym1.getFile()); //$NON-NLS-1$
+ assertEquals(100, dep4_sym1.getCount());
+ assertEquals(100, dep4_sym1_spl1.getCount());
+ assertEquals(0, dep4_sym1_spl1.getLine());
+ assertEquals("bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)", dep4_sym2.getName()); //$NON-NLS-1$
+ assertEquals("", dep4_sym2.getFile()); //$NON-NLS-1$
+ assertEquals(40, dep4_sym2.getCount());
+ assertEquals(40, dep4_sym2_spl1.getCount());
+ assertEquals(0, dep4_sym2_spl1.getLine());
+
+
+ assertEquals(OpModelImage.IMAGE_PARSE_ERROR, parsedErrorImage.getCount());
+ assertEquals(0, parsedErrorImage.getDepCount());
+ assertNull(parsedErrorImage.getDependents());
+ assertNull(parsedErrorImage.getSymbols());
+ assertEquals("", parsedErrorImage.getName()); //$NON-NLS-1$
+ }
+
+ public void testStringOutput() throws Exception {
+ assertEquals(IMAGE_OUTPUT, parsedImage.toString());
+ assertEquals(IMAGE_OUTPUT_WITHTAB, parsedImage.toString("\t")); //$NON-NLS-1$
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestSessionsParse.java b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestSessionsParse.java
new file mode 100644
index 0000000000..4e585ffe11
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/src/org/eclipse/linuxtools/oprofile/core/tests/TestSessionsParse.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.tests;
+
+import java.io.FileReader;
+import java.util.ArrayList;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.sessions.SessionsProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class TestSessionsParse extends TestCase {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_sessions.xml"; //$NON-NLS-1$
+ private static final String EVENT1_OUTPUT = "BR_INST_EXEC\nSession: current\n"; //$NON-NLS-1$
+ private static final String EVENT1_OUTPUT_WITHTAB = "BR_INST_EXEC\n\tSession: current\n"; //$NON-NLS-1$
+ private static final String EVENT2_OUTPUT = "CPU_CLK_UNHALTED\nSession: saved\n"; //$NON-NLS-1$
+ private static final String EVENT2_OUTPUT_WITHTAB = "CPU_CLK_UNHALTED\n\tSession: saved\n"; //$NON-NLS-1$
+ private static final String EVENT3_OUTPUT = "UOPS_RETIRED\nSession: current\nSession: \"<>&'\n"; //$NON-NLS-1$
+ private static final String EVENT3_OUTPUT_WITHTAB = "UOPS_RETIRED\n\tSession: current\n\tSession: \"<>&'\n"; //$NON-NLS-1$
+
+ private ArrayList<OpModelEvent> eventList;
+
+
+ public TestSessionsParse() {
+ super("test sessions parsers"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ /* this code mostly taken from OpxmlRunner */
+ XMLReader reader = null;
+ eventList = new ArrayList<OpModelEvent>();
+ SessionsProcessor.SessionInfo sessioninfo = new SessionsProcessor.SessionInfo(eventList);
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(sessioninfo);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(CoreTestsPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ }
+
+ public void testParse() {
+ assertEquals(3, eventList.size());
+ OpModelEvent evt1 = eventList.get(0), evt2 = eventList.get(1), evt3 = eventList.get(2);
+
+ assertEquals("BR_INST_EXEC", evt1.getName()); //$NON-NLS-1$
+ assertEquals("CPU_CLK_UNHALTED", evt2.getName()); //$NON-NLS-1$
+ assertEquals("UOPS_RETIRED", evt3.getName()); //$NON-NLS-1$
+
+ OpModelSession[] evt1_ss = evt1.getSessions(), evt2_ss = evt2.getSessions(), evt3_ss = evt3.getSessions();
+ assertEquals(1, evt1_ss.length);
+ assertEquals(1, evt2_ss.length);
+ assertEquals(2, evt3_ss.length);
+ OpModelSession evt1_ss_s1 = evt1_ss[0];
+ OpModelSession evt2_ss_s1 = evt2_ss[0];
+ OpModelSession evt3_ss_s1 = evt3_ss[0];
+ OpModelSession evt3_ss_s2 = evt3_ss[1];
+
+ assertEquals("current", evt1_ss_s1.getName()); //$NON-NLS-1$
+ assertEquals(true, evt1_ss_s1.isDefaultSession());
+ assertNull(evt1_ss_s1.getImage());
+ assertEquals(0, evt1_ss_s1.getCount());
+ assertEquals(evt1, evt1_ss_s1.getEvent());
+
+ assertEquals("saved", evt2_ss_s1.getName()); //$NON-NLS-1$
+ assertEquals(false, evt2_ss_s1.isDefaultSession());
+ assertNull(evt2_ss_s1.getImage());
+ assertEquals(0, evt2_ss_s1.getCount());
+ assertEquals(evt2, evt2_ss_s1.getEvent());
+
+ assertEquals("current", evt3_ss_s1.getName()); //$NON-NLS-1$
+ assertEquals(true, evt3_ss_s1.isDefaultSession());
+ assertNull(evt3_ss_s1.getImage());
+ assertEquals(0, evt3_ss_s1.getCount());
+ assertEquals(evt3, evt3_ss_s1.getEvent());
+
+ assertEquals("\"<>&'", evt3_ss_s2.getName()); //$NON-NLS-1$
+ assertEquals(false, evt3_ss_s2.isDefaultSession());
+ assertNull(evt3_ss_s2.getImage());
+ assertEquals(0, evt3_ss_s2.getCount());
+ assertEquals(evt3, evt3_ss_s2.getEvent());
+ }
+
+ public void testStringOutput() throws Exception {
+ assertEquals(EVENT1_OUTPUT, eventList.get(0).toString());
+ assertEquals(EVENT1_OUTPUT_WITHTAB, eventList.get(0).toString("\t")); //$NON-NLS-1$
+ assertEquals(EVENT2_OUTPUT, eventList.get(1).toString());
+ assertEquals(EVENT2_OUTPUT_WITHTAB, eventList.get(1).toString("\t")); //$NON-NLS-1$
+ assertEquals(EVENT3_OUTPUT, eventList.get(2).toString());
+ assertEquals(EVENT3_OUTPUT_WITHTAB, eventList.get(2).toString("\t")); //$NON-NLS-1$
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core.tests/test.xml b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/test.xml
new file mode 100644
index 0000000000..0123d5079b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core.tests/test.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+ <property name="classname" value="org.eclipse.linuxtools.oprofile.core.tests.AllCoreTests" />
+ <property name="plugin-name" value="org.eclipse.linuxtools.oprofile.core.tests" />
+
+ <property name="library-file" value="${eclipse-home}/dropins/${subProjectName2}/plugins/org.eclipse.test/library.xml" />
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}/../.." />
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp />
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml" />
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="oprofile_core_suite">
+ <property name="oprofile-core-folder" value="${eclipse-home}/oprofile_core_folder" />
+ <delete dir="${oprofile-core-folder}" quiet="true" />
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${oprofile-core-folder}" />
+ <property name="plugin-name" value="${plugin-name}" />
+ <property name="classname" value="${classname}" />
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <mkdir dir="${results}/consolelogs" />
+ <copy failonerror="false" file="${eclipse-home}/results/${classname}.txt" tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,oprofile_core_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml" />
+ <property name="output-file" value="${plugin-name}.xml" />
+ </ant>
+ </target>
+
+ <target name="all" depends="run" description="Dummy target to run all tests">
+ </target>
+
+</project>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.core/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/.project b/oprofile/org.eclipse.linuxtools.oprofile.core/.project
new file mode 100644
index 0000000000..f6a0d6999d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.core</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..fdf3224780
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Thu Jan 15 14:14:30 EST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/ChangeLog b/oprofile/org.eclipse.linuxtools.oprofile.core/ChangeLog
new file mode 100644
index 0000000000..96f1804a1e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/ChangeLog
@@ -0,0 +1,21 @@
+2010-05-07 Andrew Overholt <overholt@redhat.com>
+
+ * src/org/eclipse/linuxtools/oprofile/core/oprofile.properties: Fix typo
+ with \find instead of \nfind.
+
+2010-05-05 Andrew Overholt <overholt@redhat.com>
+
+ * src/org/eclipse/linuxtools/oprofile/core/oprofile.properties: Clean up
+ build/install instructions.
+
+2009-12-07 Andrew Overholt <overholt@redhat.com>
+
+ Bug #297007
+
+ * natives/linux/opxml/move_opxml.sh: Fix release number.
+
+2009-10-29 Andrew Overholt <overholt@redhat.com>
+
+ Bug #292172
+
+ * natives/linux/opxml/move_opxml.sh: Update release number. \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c4343ced02
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.core;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.daemon,
+ org.eclipse.linuxtools.oprofile.core.linux,
+ org.eclipse.linuxtools.oprofile.core.model,
+ org.eclipse.linuxtools.oprofile.core.opxml,
+ org.eclipse.linuxtools.oprofile.core.opxml.checkevent,
+ org.eclipse.linuxtools.oprofile.core.opxml.info,
+ org.eclipse.linuxtools.oprofile.core.opxml.modeldata,
+ org.eclipse.linuxtools.oprofile.core.opxml.sessions
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/README b/oprofile/org.eclipse.linuxtools.oprofile.core/README
new file mode 100644
index 0000000000..4f47299329
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/README
@@ -0,0 +1,23 @@
+An extra step is required to install the plugin (due to OProfile's lack of a user-space mode):
+
+* Run the install script in the natives/linux/scripts directory (must be as root):
+
+ # ./install
+
+ * This will ensure all the necessary programs are installed, and create a wrapper for opcontrol
+ which prompts for the root password (since OProfile must be run as root). It will also load the
+ OProfile kernel module, however it is not loaded persistently. Hence, after the computer is
+ restarted and any functions of the plugin are used, there will be an extra prompt to run
+ opcontrol that would not normally appear.
+
+ * If there are any programs missing or an error occurs, the script will fail and display the error.
+ If there are no errors, you will see the message:
+
+ Eclipse-OProfile plugin install successful.
+
+
+* To uninstall the plugin, run the uninstall script in the natives/linux/scripts (must be root):
+
+ # ./uninstall
+
+ * This will simply remove the same files the install script created. \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/about.html b/oprofile/org.eclipse.linuxtools.oprofile.core/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.core/build.properties
new file mode 100644
index 0000000000..39977e0112
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/build.properties
@@ -0,0 +1,19 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html,\
+ README,\
+ natives/,\
+ schema/
+src.includes = META-INF/,\
+ README,\
+ about.html,\
+ src/,\
+ plugin.xml,\
+ plugin.properties,\
+ natives/,\
+ schema/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/.svnignore
new file mode 100644
index 0000000000..5366501966
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/.svnignore
@@ -0,0 +1,15 @@
+opxml.o
+stable.o
+oprofiledb.o
+symbol.o
+sample.o
+session.o
+samplefile.o
+imageheader.o
+opinfo.o
+xmlfmt.o
+xmlbuf.o
+xmltag.o
+sevent.o
+profileimage.o
+opxml
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/Makefile b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/Makefile
new file mode 100644
index 0000000000..e532b37a61
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/Makefile
@@ -0,0 +1,78 @@
+# Makefile for Eclipse Oprofile wrapper library
+# Written by Keith Seitz <keiths@redhat.com>
+# Edited by Kent Sebastian <ksebasti@redhat.com>
+#
+# Copyright (c) 2004,2008 Red Hat, Inc.
+
+CFLAGS += -g -Wall
+CXXFLAGS = $(CFLAGS)
+
+OPROFILE_LIBS = -lop -lodb -loputil++ -loputil
+BFD_LIBRARY = -lbfd
+LIBIBERTY = -liberty
+OTHER_LIBS = $(BFD_LIBRARY)
+EXTRA_LIBS = $(OPROFILE_LIBS) $(OTHER_LIBS) $(LIBIBERTY)
+
+OPXML = opxml
+OPXML_OBJS = opxml.o
+OPROFILE_LIB_OBJS = stable.o oprofiledb.o symbol.o sample.o \
+ session.o samplefile.o imageheader.o opinfo.o \
+ xmlfmt.o xmlbuf.o xmltag.o \
+ sevent.o profileimage.o
+
+all: $(OPXML)
+
+$(OPXML): $(OPROFILE_LIB_OBJS) $(OPXML_OBJS)
+ $(CXX) -o $(OPXML) $(OPXML_OBJS) $(OPROFILE_LIB_OBJS) \
+ $(EXTRA_LIBS)
+
+clean:
+ $(RM) $(OPROFILE_LIB_OBJS) $(OPXML) $(OPXML_OBJS) $(OPXML_EXEC) *~
+
+install:
+ sh move_opxml.sh
+
+# Dependencies
+opxml.o: oxmlstream.h opinfo.h session.h sample.h sevent.h opxml.cc
+
+imageheader.o: xmlfmt.h imageheader.h imageheader.cc
+imageheader.h: samplefile.h
+
+opinfo.o: opinfo.h opinfo.cc
+opinfo.h:
+
+oprofiledb.o: oprofiledb.h sample.h stable.h oprofiledb.cc
+oprofiledb.h: xmlbuf.h xmlfmt.h
+
+oxmlstream.h: xmlbuf.h xmlfmt.h
+
+profileimage.o: xmlfmt.h profileimage.h profileimage.cc sample.h
+profileimage.h: samplefile.h
+
+sample.o: xmlfmt.h sample.h sample.cc symbol.h symbol.cc
+sample.h:
+
+samplefile.o: sample.h stable.h xmlfmt.h samplefile.h samplefile.cc
+samplefile.h: oprofiledb.h
+
+session.o: sevent.h opinfo.h xmlfmt.h session.h session.cc
+session.h: samplefile.h
+
+sevent.o: session.h xmlfmt.h sevent.h sevent.cc
+sevent.h: profileimage.h
+
+stable.o: stable.h symbol.h stable.cc
+stable.h:
+
+symbol.o: xmlfmt.h symbol.h symbol.cc
+symbol.h: sample.h
+
+xmlbuf.o: xmltag.h xmlbuf.h xmlbuf.cc
+xmlbuf.h:
+
+xmlfmt.o: xmlbuf.h xmlfmt.h xmlfmt.cc
+xmlfmt.h:
+
+xmltag.o: xmltag.h xmltag.cc
+xmltag.h:
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/README b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/README
new file mode 100644
index 0000000000..6a027ed9f9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/README
@@ -0,0 +1,8 @@
+opxml requires 4 packages to be compiled:
+
+* oprofile
+* oprofile-devel
+* binutils-devel
+* binutils-static
+
+These packages may vary in name and some may be combined across distributions.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.cc
new file mode 100644
index 0000000000..d8b560cbda
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.cc
@@ -0,0 +1,35 @@
+/* imageheader - a class which represents the "header" information for a given
+ image.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "imageheader.h"
+#include "xmlfmt.h"
+
+using namespace std;
+
+imageheader::imageheader (const samplefile* sfile)
+ : _sfile (sfile)
+{
+}
+
+ostream&
+operator<< (ostream& os, const imageheader* ihdr)
+{
+ return os << startt ("header")
+ << startt ("cpu_type") << ihdr->get_cpu () << endt
+ << startt ("count") << ihdr->get_count () << endt
+ << startt ("event") << ihdr->get_event () << endt
+ << startt ("unit-mask") << ihdr->get_unit_mask () << endt
+ << startt ("cpu-speed") << ihdr->get_cpu_speed () << endt
+ << endt;
+}
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.h
new file mode 100644
index 0000000000..ec1f904f1f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/imageheader.h
@@ -0,0 +1,48 @@
+/* imageheader - a class which represents the "header" info for a given
+ image.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _IMAGEHEADER_H
+#define _IMAGEHEADER_H
+#include <ostream>
+#include <string>
+
+#include "samplefile.h"
+
+class imageheader
+{
+ public:
+ // Constructor - pass in the oprofile header
+ imageheader (const samplefile* sfile);
+
+ // Returns the cpu type
+ inline std::string get_cpu (void) const { return _sfile->get_cpu (); };
+
+ // Returns the event collected
+ inline std::string get_event (void) const { return _sfile->get_event (); };
+
+ // Returns the count
+ inline std::string get_count (void) const { return _sfile->get_count (); };
+
+ // Returns the unit mask used during collection
+ inline std::string get_unit_mask (void) const { return _sfile->get_unit_mask (); };
+
+ // Returns an approx cpu speed
+ // FIXME: SUCK?
+ inline double get_cpu_speed (void) const { return 0.00; };
+
+ private:
+ const samplefile* _sfile;
+};
+
+std::ostream& operator<< (std::ostream& os, const imageheader* ihdr);
+#endif // !_SFILEHEADER_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/move_opxml.sh b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/move_opxml.sh
new file mode 100644
index 0000000000..5b526ea982
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/move_opxml.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+RELEASE_VER=0.3.0
+
+case `uname -m` in
+ 'i386') \
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.x86_${RELEASE_VER}.*/os/linux/x86
+ ;;
+ 'i586')
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.x86_${RELEASE_VER}.*/os/linux/x86
+ ;;
+ 'i686')
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.x86_${RELEASE_VER}.*/os/linux/x86
+ ;;
+ 'x86_64')
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.x86_64_${RELEASE_VER}.*/os/linux/x86_64
+ ;;
+ 'ppc')
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.ppc_${RELEASE_VER}.*/os/linux/ppc
+ ;;
+ 'ppc64')
+ mv -f opxml ../../../../org.eclipse.linuxtools.oprofile.core.linux.ppc_${RELEASE_VER}.*/os/linux/ppc
+ ;;
+ *)
+ echo Could not detect system architecture -- please move the opxml binary into the appropriate org.eclipse.linuxtools.oprofile.core.linux.[x86,x86_64,ppc]/os/linux/[x86,x86_64,ppc] directory.
+ exit 1
+ ;;
+ esac && echo Success! \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.cc
new file mode 100644
index 0000000000..6dd98415ea
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.cc
@@ -0,0 +1,225 @@
+/* Generic oprofile information class for opmxl.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "opinfo.h"
+
+#include <sstream>
+#include <string.h>
+
+#include "xmlfmt.h"
+
+using namespace std;
+
+// From liboputil.a. Sadly this won't work if we want to enable
+// remote-system profiling.
+extern "C" double op_cpu_frequency (void);
+
+// Forward declaration
+static void __output_unit_mask_info (ostream& os, const opinfo::event_t* e);
+
+// Constructor
+opinfo::opinfo (op_cpu cpu_type, string dir)
+ : _cpu_type (cpu_type), _dir (dir)
+{
+}
+
+// Returns the number of counters for this cpu type
+int
+opinfo::get_nr_counters (void) const
+{
+ return op_get_nr_counters (_cpu_type);
+}
+
+// Returns (in LIST) a list of valid events for the given counter
+void
+opinfo::get_events (eventlist_t& list, int ctr) const
+{
+ struct list_head* events, *p;
+ events = op_events (_cpu_type);
+
+ list_for_each (p, events)
+ {
+ struct op_event* event = list_entry (p, struct op_event, event_next);
+ if (/*event->counter_mask == CTR_ALL || */ event->counter_mask & (1 << ctr))
+ list.push_back (event);
+ }
+}
+
+// Returns cpu frequency
+double
+opinfo::get_cpu_frequency (void) const
+{
+ return op_cpu_frequency ();
+}
+
+// Checks whether the given CTR, EVENT, and MASK are valid
+opinfo::eventcheck
+opinfo::check (int ctr, int event, int mask) const
+{
+ eventcheck::result_t result =
+ static_cast<eventcheck::result_t> (op_check_events (ctr, event, mask, _cpu_type));
+ return eventcheck (result);
+}
+
+// Converts the given string into a corresponding op_cpu (CPU_NO_GOOD if invalid)
+op_cpu
+opinfo::str_to_op_cpu (const char* const cpu_str)
+{
+ int i;
+ for (i = 0; i < MAX_CPU_TYPE; ++i)
+ {
+ if (strcmp (op_get_cpu_type_str ((op_cpu) i), cpu_str) == 0)
+ return (op_cpu) i;
+ }
+
+ return CPU_NO_GOOD;
+}
+
+// This actually outputs a bunch of information
+ostream&
+operator<< (ostream& os, const opinfo& info)
+{
+ os << startt ("info");
+
+ // Output out number of counters and defaults
+ os << startt ("num-counters") << info.get_nr_counters () << endt
+ << startt ("cpu-frequency") << info.get_cpu_frequency () << endt
+ << startt ("defaults")
+ << startt ("sample-dir") << opinfo::get_default_samples_dir () << endt
+ << startt ("lock-file") << opinfo::get_default_lock_file () << endt
+ << startt ("log-file") << opinfo::get_default_log_file () << endt
+ << startt ("dump-status") << opinfo::get_default_dump_status () << endt
+ << endt;
+
+ if (info.get_cpu_type() == CPU_TIMER_INT)
+ {
+ os << startt ("timer-mode") << "true" << endt;
+
+ //create a fake timer event and output as normal
+ char UM_0_DESC[] = TIMER_EVENT_MASK_UM_0_DESCRIPTION;
+ char TIMER_NAME[] = TIMER_EVENT_NAME;
+ char TIMER_DESC[] = TIMER_EVENT_DESCRIPTION;
+
+ struct op_unit_mask mask;
+ mask.unit_type_mask = utm_mandatory;
+ mask.default_mask = TIMER_EVENT_MASK_DEFAULT_VALUE;
+ mask.um[0].value = TIMER_EVENT_MASK_UM_0_VALUE;
+ mask.um[0].desc = UM_0_DESC;
+ mask.num = TIMER_EVENT_MASK_UM_NUM;
+
+ opinfo::event_t timer_event;
+ timer_event.name = TIMER_NAME;
+ timer_event.desc = TIMER_DESC;
+ timer_event.val = TIMER_EVENT_NUMBER;
+ timer_event.min_count = TIMER_EVENT_MIN_COUNT;
+ timer_event.counter_mask = TIMER_EVENT_COUNTER_MASK;
+ timer_event.unit = &mask;
+
+ os << startt ("event-list") << attrt ("counter", "0");
+
+ os << (&timer_event);
+
+ os << endt;
+ }
+ else
+ {
+ os << startt ("timer-mode") << "false" << endt;
+
+ // Output event list
+ for (int ctr = 0; ctr < info.get_nr_counters (); ++ctr)
+ {
+ opinfo::eventlist_t events;
+
+ ostringstream ctr_s;
+ ctr_s << ctr;
+ os << startt ("event-list") << attrt ("counter", ctr_s.str ());
+ info.get_events (events, ctr);
+ opinfo::eventlist_t::iterator i;
+ for (i = events.begin (); i != events.end (); ++i)
+ os << (*i);
+ os << endt;
+ }
+ }
+
+ return os << endt;
+}
+
+// Prints the given EVENT on the given stream
+ostream&
+operator<< (ostream& os, const opinfo::event_t* event)
+{
+ os << startt ("event")
+ << startt ("name") << event->name << endt
+ << startt ("description") << event->desc << endt
+ << startt ("value") << static_cast<int> (event->val) << endt
+ << startt ("minimum") << static_cast<int> (event->min_count) << endt;
+
+ // ouput unit mask info
+ __output_unit_mask_info (os, event);
+
+ return os << endt;
+}
+
+// Prints the given eventcheck on the given stream
+ostream&
+operator<< (ostream& os, const opinfo::eventcheck& check)
+{
+ static const char* errors[3] = {"invalid-event", "invalid-um", "invalid-counter"};
+
+ os << startt ("check-events");
+
+ if (check.get_result () == OP_OK_EVENT)
+ os << startt ("result") << "ok" << endt;
+ else
+ {
+ for (unsigned int i = 0; i < sizeof (errors) / sizeof (errors[0]); ++i)
+ {
+ if ((check.get_result () & (1 << i)) > 0)
+ os << startt ("result") << errors[i] << endt;
+ }
+ }
+
+ return os << endt;
+}
+
+// Convenience function to output unit mask information
+static void
+__output_unit_mask_info (ostream& os, const opinfo::event_t* event)
+{
+ const struct op_unit_mask* umask = event->unit;
+ const char* type;
+
+ switch (umask->unit_type_mask)
+ {
+ case utm_exclusive:
+ type = "exclusive"; break;
+ case utm_bitmask:
+ type = "bitmask"; break;
+ case utm_mandatory:
+ default:
+ type = "mandatory"; break;
+ }
+
+ os << startt ("unit-mask")
+ << startt ("type") << type << endt
+ << startt ("default") << umask->default_mask << endt;
+
+ for (u32 i = 0; i < umask->num; ++i)
+ {
+ os << startt ("mask")
+ << startt ("value") << umask->um[i].value << endt
+ << startt ("description") << umask->um[i].desc << endt
+ << endt;
+ }
+
+ os << endt;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.h
new file mode 100644
index 0000000000..958f9fb180
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opinfo.h
@@ -0,0 +1,118 @@
+/* Generic oprofile information class for opmxl.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _OPINFO_H
+#define _OPINFO_H
+#include <vector>
+#include <ostream>
+
+#include <op_cpu_type.h>
+#include <op_config.h>
+#include <op_events.h>
+
+#define OP_SAMPLES_DIR "/var/lib/oprofile/samples/"
+#define OP_LOCK_FILE "/var/lib/oprofile/lock"
+#define OP_LOG_FILE "/var/lib/oprofile/samples/oprofiled.log"
+#define OP_DUMP_STATUS "/var/lib/oprofile/complete_dump"
+#define TIMER_EVENT_NAME "TIMER"
+#define TIMER_EVENT_DESCRIPTION "Profiling through timer interrupt"
+#define TIMER_EVENT_NUMBER 0
+#define TIMER_EVENT_MIN_COUNT 0
+#define TIMER_EVENT_COUNTER_MASK 0
+#define TIMER_EVENT_MASK_DEFAULT_VALUE 0
+#define TIMER_EVENT_MASK_UM_NUM 1
+#define TIMER_EVENT_MASK_UM_0_VALUE 0
+#define TIMER_EVENT_MASK_UM_0_DESCRIPTION "No unit mask"
+
+struct op_event;
+
+// A class which knows about static oprofile information, i.e., things
+// which do not depend on sample files.
+class opinfo
+{
+ public:
+ // The type of an oprofile event
+ typedef struct op_event event_t;
+
+ // The type of a list of oprofile events
+ typedef std::vector<event_t*> eventlist_t;
+
+ // A class used for reporting the validity of an event.
+ // Used by opinfo::check.
+ class eventcheck
+ {
+ public:
+ // The result type returned by get_result;
+ typedef enum op_event_check result_t;
+
+ // Constructor
+ eventcheck (result_t ec) : _ec (ec) {};
+
+ // Returns the result of the check. Can be (bitmask):
+ // OP_OK_EVENT, OP_INVALID_EVENT, OP_INVALID_UM, OP_INVALID_COUNTER
+ inline result_t get_result (void) const { return _ec; };
+
+ private:
+ // The result from the check
+ result_t _ec;
+ };
+
+ // Get the default sample directory
+ inline static const char* get_default_samples_dir (void) { return OP_SAMPLES_DIR; };
+
+ // Get the default lock filename
+ inline static const char* get_default_lock_file (void) { return OP_LOCK_FILE; };
+
+ // Get the default log filename
+ inline static const char* get_default_log_file (void) { return OP_LOG_FILE; };
+
+ // Get the default dump status filename
+ inline static const char* get_default_dump_status (void) { return OP_DUMP_STATUS; };
+
+ // Converts the given string into an enum op_cpu
+ static op_cpu str_to_op_cpu (const char* const cpu_str);
+
+ // Constructors
+ opinfo (op_cpu cpu_type = op_get_cpu_type (), std::string dir = get_default_samples_dir ());
+
+ // Returns the number of counters for this cpu type
+ int get_nr_counters (void) const;
+
+ // Returns a list of valid events for the given counter on this cpu type
+ void get_events (eventlist_t& list, int ctr) const;
+
+ // Returns the samples directory in use
+ inline const std::string& get_samples_directory (void) const { return _dir; };
+
+ // Returns the CPU frequency in MHz
+ double get_cpu_frequency (void) const;
+
+ // Returns an eventcheck object representing whether the given
+ // CTR, EVENT, and MASK are valid for this cpu type
+ eventcheck check (int ctr, int event, int mask) const;
+
+ // Returns the cpu type being used
+ op_cpu get_cpu_type (void) const { return _cpu_type; };
+
+ private:
+ // The cpu type
+ op_cpu _cpu_type;
+
+ // The sample directory to use
+ std::string _dir;
+};
+
+// Insert operators for various classes defined in this file
+std::ostream& operator<< (std::ostream& os, const opinfo::eventcheck& ec);
+std::ostream& operator<< (std::ostream& os, const opinfo::event_t* event);
+std::ostream& operator<< (std::ostream& os, const opinfo& info);
+#endif // !_OPINFO_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.cc
new file mode 100644
index 0000000000..808e50526a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.cc
@@ -0,0 +1,160 @@
+/* oprofile_db - An Oprofile sample file database wrapper.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <iostream>
+#include <op_sample_file.h>
+#include <string.h>
+
+#include "oprofiledb.h"
+#include "stable.h"
+#include "sample.h"
+
+oprofile_db::oprofile_db (std::string filename)
+ : _filename (filename), _tree (NULL), _symbol_table (NULL), _is_kernel (false)
+{
+}
+
+oprofile_db::~oprofile_db ()
+{
+ _close_db ();
+ samples_t::iterator i = _samples.begin ();
+ while (i != _samples.end ())
+ {
+ delete SAMPLE (*i);
+ ++i;
+ }
+ _samples.clear ();
+}
+
+void
+oprofile_db::_open_db (void)
+{
+ if (_tree == NULL)
+ {
+ int rc;
+
+ _tree = new odb_t;
+ rc = odb_open (_tree, _filename.c_str (), ODB_RDONLY, sizeof (opd_header));
+ if (rc != 0)
+ {
+ // This shouldn't happen, but let's at least print something out.
+ std::cerr << "Error opening oprofile database: " << strerror (rc)
+ << std::endl;
+ return;
+ }
+
+ // Get the is_kernel parameter: this is needed for sample gathering later
+ const opd_header* hdr = static_cast<opd_header*> (odb_get_data (_tree));
+ _is_kernel = (hdr->is_kernel != 0);
+ }
+}
+
+void
+oprofile_db::_close_db (void)
+{
+ if (_tree != NULL)
+ {
+ odb_close (_tree);
+ delete _tree;
+ }
+
+ _tree = NULL;
+}
+
+static void
+samples_odb_travel (odb_t* hash, int start, int end, oprofile_db::callback_t callback, void* data)
+{
+ odb_node_nr_t node_nr, pos;
+ odb_node_t* node = odb_get_iterator (hash, &node_nr);
+ for (pos = 0; pos < node_nr; ++pos)
+ {
+ if (node[pos].key)
+ callback (node[pos].key, node[pos].value, data);
+ }
+}
+
+void
+oprofile_db::walk_samples (callback_t callback, void* data)
+{
+ _open_db ();
+ samples_odb_travel (_tree, 0, ~0, callback, data);
+ _close_db ();
+}
+
+const oprofile_db::samples_t&
+oprofile_db::get_samples (symboltable* stable)
+{
+ _symbol_table = stable;
+ walk_samples (_get_samples_callback, this);
+ _symbol_table = NULL;
+ return _samples;
+}
+
+bool
+oprofile_db::has_samples (void)
+{
+ walk_samples (_has_samples_callback, this);
+ return _has_samples;
+}
+
+long
+oprofile_db::get_count (void)
+{
+ long count = 0;
+ walk_samples (_get_count_callback, &count);
+ return count;
+}
+
+// This is a callback from oprofile when traveling the samples in the sample file.
+void
+oprofile_db::_get_samples_callback (odb_key_t key, odb_value_t info, void* data)
+{
+ oprofile_db* odb = static_cast<oprofile_db*> (data);
+
+ symbol* symbol = NULL;
+ bfd_vma real_addr;
+ if (odb->_symbol_table != NULL)
+ symbol = odb->_symbol_table->lookup_vma ((bfd_vma) key, real_addr, odb->_is_kernel);
+
+ // Oprofile can have multiple samples for the same VMA, so look in the
+ // our map/database and see if the given VMA exists. If it does not exist,
+ // add a new Sample. If it does exist, just increment the count of the Sample
+ // by INFO.
+ samples_t::iterator i = odb->_samples.find ((bfd_vma) key);
+ if (i == odb->_samples.end ())
+ {
+ // new sample
+ sample* s = new sample (real_addr, symbol, info);
+ odb->_samples.insert (sample_t (key, s));
+ }
+ else
+ {
+ // existing sample
+ SAMPLE (*i)->incr_count (info);
+ }
+}
+
+void
+oprofile_db::_has_samples_callback (odb_key_t key, odb_value_t info, void* data)
+{
+ oprofile_db* odb = static_cast<oprofile_db*> (data);
+ if (info > 0)
+ odb->has_samples (true);
+}
+
+void
+oprofile_db::_get_count_callback (odb_key_t key, odb_value_t info, void* data)
+{
+ long* count = static_cast<long*> (data);
+ *count += info;
+}
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.h
new file mode 100644
index 0000000000..23e83a2ce0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oprofiledb.h
@@ -0,0 +1,92 @@
+/* oprofile_db - An Oprofile sample file database wrapper.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _OPROFILEDB_H
+#define _OPROFILEDB_H
+
+#include <map>
+#include <string>
+#include <bfd.h>
+#include <odb.h>
+
+class sample;
+class symboltable;
+
+// A class which represents an oprofile sample database. This is much
+// lower-level stuff than class samplefile.
+class oprofile_db
+{
+ public:
+ typedef void (*callback_t)(odb_key_t, odb_value_t, void*);
+
+ // Creates an oprofile_db from the given sample file
+ oprofile_db (std::string sample_file);
+ ~oprofile_db ();
+
+ // Function object used to compare VMA for sorting
+ struct ltvma
+ {
+ bool operator() (const bfd_vma a, const bfd_vma b) const
+ { return (a < b); }
+ };
+
+ // The type of the sample database returned be get_samples
+ typedef std::map<const bfd_vma, sample*, ltvma> samples_t;
+
+ // The type of one sample in the database
+ typedef std::pair<const bfd_vma, sample*> sample_t;
+
+ // Macro to fetch the sample from the sample_t.
+ static inline sample* SAMPLE (sample_t sample) { return sample.second; }
+
+ // Retrieves the sample database using STABLE as a symbol table (may be NULL)
+ const samples_t& get_samples (symboltable* stable);
+
+ // Set/query whether the db has any samples in it
+ bool has_samples (void);
+ void has_samples (bool yesno) { _has_samples = yesno; };
+
+ // Get the total number of samples in this samplefile
+ long get_count (void);
+
+ // Walks the samples with the given callback
+ void walk_samples (callback_t callback, void* data);
+
+ protected:
+ // Callbacks for walking oprofile sample database
+ static void _get_samples_callback (odb_key_t key, odb_value_t info, void* data);
+ static void _has_samples_callback (odb_key_t key, odb_value_t info, void* data);
+ static void _get_count_callback (odb_key_t key, odb_value_t info, void* data);
+
+ // Makes sure the oprofile sample file is open
+ void _open_db (void);
+
+ // Closes the oprofile sample file
+ void _close_db (void);
+
+ // The sample file
+ std::string _filename;
+
+ // The oprofile sample database for the file
+ odb_t* _tree;
+
+ // A map of all the samples
+ samples_t _samples;
+
+ // The symbol table used to resolve VMA into symbols
+ symboltable* _symbol_table;
+
+ bool _has_samples;
+ callback_t _callback;
+ bool _is_kernel;
+};
+#endif // !_OPROFILEDB_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opxml.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opxml.cc
new file mode 100644
index 0000000000..55dfb2b08c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/opxml.cc
@@ -0,0 +1,495 @@
+/* Opxml a simple program to output XML descriptions of oprofile sample
+ files (and a little more). This program exists as a bridge between
+ GPL'd software (oprofile and BFD) and EPL'd software (Eclipse).
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+
+ Copyright 2004, 2008, 2009 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <stdlib.h>
+#include <iostream>
+#include <string.h>
+#include <getopt.h>
+#include <errno.h>
+#include <iterator>
+#include <vector>
+#include <set>
+
+#include "opinfo.h"
+#include "oxmlstream.h"
+#include "session.h"
+#include "sample.h"
+#include "sevent.h"
+
+using namespace std;
+
+// Enum describing info options
+enum options
+{
+ INFO,
+ CHECK_EVENT,
+ MODEL_DATA,
+ SESSIONS
+};
+
+// Strings of options
+static const char* options[] =
+{
+ "info",
+ "check-events",
+ "model-data",
+ "sessions",
+ 0
+};
+
+// Help for options
+struct help
+{
+ const char* arg;
+ const char* desc;
+};
+
+static const struct help args_help[] =
+{
+ {"[CPU]\t\t\t", "information for given cpu (defualt: current cpu)" },
+ {"CTR EVENT UMASK\t", "check counter/event validity"},
+ {"EVENT SESSION\t", "get model data (image, symbols, samples..) for given SESSION and EVENT"},
+ {"\t\t\t", "get session information"}
+};
+
+//hacky struct to ensure that the default session is
+// always printed out first (and the rest alphabetical)
+struct sevent_comp {
+ bool operator() (const sessionevent* lhs, const sessionevent* rhs) { return (lhs->get_session()->get_name() < rhs->get_session()->get_name()); }
+};
+
+typedef set<sessionevent*, struct sevent_comp > ordered_sessions_t;
+struct session_list_t {
+ sessionevent* default_sevent;
+ ordered_sessions_t* sessions;
+};
+
+
+
+const string DEFAULT_SESSION_NAME = "current";
+
+// Local functions
+static void print_usage (const char* const argv0);
+static int get_option_index (const char* options[], const char* arg);
+static void wrong_num_arguments (int argc, char* argv[], const char* opts);
+static int get_integer (const char* arg);
+
+// Info handlers
+static int info (opinfo& info, int argc, char* argv[]);
+static int check_events (opinfo& info, int argc, char* argv[]);
+static int model_data (opinfo& info, int argc, char* argv[]);
+static int sessions (opinfo& info, int argc, char* argv[]);
+
+//helper function
+static bool object_in_list(const string obj, const vector<string>& objects);
+
+
+static void
+wrong_num_arguments (int argc, char* argv[], const char* opts)
+{
+ cerr << "wrong # args: should be \"";
+ for (int i = 0; i < argc; ++i)
+ cerr << argv[i] << " ";
+
+ cerr << opts << "\"" << endl;
+ exit (EXIT_FAILURE);
+}
+
+// Converts the argument into its corresponding option index
+static int
+get_option_index (const char* options[], const char* arg)
+{
+ const char* option;
+
+ int i = 0;
+ for (option = options[0]; option != NULL; option = options[++i])
+ {
+ if (strncmp (option, arg, strlen (arg)) == 0)
+ return i;
+ }
+
+ return -1;
+}
+
+// Prints a small help message
+static void
+print_help (const char* const argv0)
+{
+ cerr << "Use '" << argv0 << " --help' for a complete list of options."
+ << endl;
+}
+
+// Prints the usage of this program
+static void
+print_usage (const char* const argv0)
+{
+ cerr << argv0 << ": usage: " << argv0 << " [OPTION] INFO [INFO_OPTIONS]" << endl;
+ cerr << "Supply information about Oprofile and its sample files." << endl << endl;
+ cerr << "Options:" << endl << endl;
+ cerr << "-c, --cpu CPU_TYPE\t\t cpu type (current: "
+ << op_get_cpu_type_str (op_get_cpu_type ()) << ")" << endl;
+ cerr << "-d, --dir SAMPLES_DIR\t\t set sample directory (default: "
+ << opinfo::get_default_samples_dir () << ")" << endl;
+
+ cerr << endl << "Types of INFO:" << endl << endl;
+
+ for (unsigned int i = 0; i < (sizeof (args_help) / sizeof (args_help[0])); ++i)
+ {
+ cerr << options[i] << " " << args_help[i].arg << " "
+ << args_help[i].desc << endl;
+ }
+}
+
+int
+main (int argc, char* argv[])
+{
+ const char* argv0 = argv[0];
+
+ if (argc < 2)
+ {
+ print_help (argv0);
+ exit (EXIT_FAILURE);
+ }
+
+ op_cpu cpu_type = op_get_cpu_type ();
+ string dir = opinfo::get_default_samples_dir ();
+
+ static struct option long_options[] =
+ {
+ {"cpu-type", required_argument, 0, 'c'},
+ {"dir", required_argument, 0, 'd'},
+ {"help", no_argument, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ int index;
+ while (true)
+ {
+ int c;
+ c = getopt_long_only (argc, argv, "+", long_options, &index);
+ if (c == -1)
+ break;
+
+ if (c == 0 && long_options[index].flag == 0)
+ c = long_options[index].val;
+
+ switch (c)
+ {
+ case 'c':
+ cpu_type = opinfo::str_to_op_cpu (optarg);
+ if (cpu_type == CPU_NO_GOOD)
+ {
+ cerr << argv0 << ": cpu \"" << optarg << "\" not recognized"
+ << endl;
+ exit (EXIT_FAILURE);
+ }
+ break;
+
+ case 'd':
+ dir = optarg;
+ break;
+
+ case 'h':
+ print_usage (argv0);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case '?':
+ print_help (argv0);
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ // Check that we have a valid cpu type. It can be invalid (here) because
+ // the Oprofile module not loaded/running. Oprofile library will output error.
+ if (cpu_type == CPU_NO_GOOD)
+ exit (EXIT_FAILURE);
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc == 0)
+ {
+ print_help (argv0);
+ exit (EXIT_FAILURE);
+ }
+
+ int rc;
+ opinfo oinfo (cpu_type, dir);
+ index = get_option_index (options, argv[0]);
+ {
+ switch ((enum options) index)
+ {
+ case INFO:
+ rc = info (oinfo, argc, argv);
+ break;
+
+ case CHECK_EVENT:
+ rc = check_events (oinfo, argc, argv);
+ break;
+
+ case MODEL_DATA:
+ rc = model_data(oinfo, argc, argv);
+ break;
+
+ case SESSIONS:
+ rc = sessions (oinfo, argc, argv);
+ break;
+
+ default:
+ cerr << argv0 << ": unknown option \"" << argv[0] << "\""
+ << endl;
+ print_help (argv0);
+ rc = EXIT_FAILURE;
+ }
+ }
+
+ return rc;
+}
+
+/* Get an integer value from the argument. Only does ints > 0.
+ Returns the integer or -1. */
+static int
+get_integer (const char* arg)
+{
+ errno = 0;
+ int integer = strtol (arg, NULL, 10);
+ if (errno != 0)
+ return -errno;
+
+ return integer;
+}
+
+/* Output static information about oprofile for this cpu type. */
+static int
+info (opinfo& info, int argc, char* argv[])
+{
+ oxmlstream oxml (cout);
+ oxml << info << endxml;
+ return EXIT_SUCCESS;
+}
+
+/* Check whether the given counter/event/umask info is valid.
+ *
+ * Input: COUNTER EVENT UMASK (all integers)
+ * Note: output is a BITMASK of errors. Expect multiple "result" fields on error.
+ */
+static int
+check_events (opinfo& info, int argc, char* argv[])
+{
+ if (argc != 4)
+ wrong_num_arguments (1, argv, "counter event umask");
+
+ int counter = get_integer (argv[1]);
+ if (counter < 0)
+ {
+ cerr << "invalid counter \"" << argv[1] << "\"" << endl;
+ return EXIT_FAILURE;
+ }
+
+ if (counter >= info.get_nr_counters ())
+ {
+ cerr << "counter must not be greater than "
+ << (info.get_nr_counters () - 1) << endl;
+ return EXIT_FAILURE;
+ }
+
+ int event = get_integer (argv[2]);
+ if (event < 0)
+ {
+ cerr << "invalid event \"" << argv[2] << "\"" << endl;
+ return EXIT_FAILURE;
+ }
+
+ int umask = get_integer (argv[3]);
+ if (umask < 0)
+ {
+ cerr << "invalid unit mask \"" << argv[3] << "\"" << endl;
+ return EXIT_FAILURE;
+ }
+
+ opinfo::eventcheck result = info.check (counter, event, umask);
+
+ oxmlstream oxml (cout);
+ oxml << result << endxml;
+ return EXIT_SUCCESS;
+}
+
+/* Print out the samples associated with the given session
+ *
+ * Input:
+ * event name
+ * session name (a default session is 'current')
+ */
+static int
+model_data (opinfo& info, int argc, char* argv[])
+{
+ //TODO: should this be xml so the parser can parse such an error?
+ if (argc < 3)
+ wrong_num_arguments (1, argv, "event session");
+
+ string event (argv[1]);
+ string session_name (argv[2]);
+
+ vector<string> object_list;
+ if (argc >= 3)
+ {
+ //make a list of binary paths to filter out images
+ for (int j = 3; j < argc; j++) {
+ object_list.insert(object_list.begin(), argv[j]);
+ }
+ }
+ session session (session_name, &info);
+
+ //passing the object list in here filters the images that
+ // are added to the sessionevent from an early stage
+ sessionevent* sevent = session.get_event (event);
+
+ if (sevent == NULL)
+ {
+ oxmlstream oxml (cout);
+ oxml << startt ("error");
+
+ oxml << "no such session, event or matching images: "
+ << "session=" << session_name
+ << "; event=" << event
+ << endt << endxml;
+
+ return EXIT_FAILURE;
+ }
+
+ sessionevent::profileimages_t* images = sevent->get_images ();
+
+ oxmlstream oxml (cout);
+ oxml << startt ("model-data");
+
+ sessionevent::profileimages_t::iterator i;
+ for (i = images->begin (); i != images->end (); ++i)
+ {
+ if (object_list.empty() || object_in_list((*i)->get_name(),object_list))
+ oxml << (*i);
+ }
+
+ oxml << endt << endxml;
+
+ // delete sevent; -- don't do this: it takes too much time!
+ return EXIT_SUCCESS;
+}
+
+static bool
+object_in_list(const string obj, const vector<string>& objects) {
+ vector<string>::const_iterator it;
+
+ for (it = objects.begin(); it != objects.end(); it++) {
+ if ((*it) == obj) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+//The special case handling for the default event is to enusure it is always
+// the first event ouput. This is for usability of the UI on the java side
+// so that the current session is always the first in the view.
+static int
+sessions (opinfo& info, int argc, char* argv[])
+{
+ session::sessionlist_t sessions;
+ sessions = session::get_sessions (info);
+
+
+ /* This seems goofy, but this is best for the UI.
+ Arrange the sessions by the event that they collected. */
+
+ typedef map<string, struct session_list_t* > eventlist_t;
+ eventlist_t eventlist;
+
+ session::sessionlist_t::iterator sit = sessions.begin ();
+ session::sessionlist_t::iterator const send = sessions.end ();
+ for (; sit != send; ++sit)
+ {
+ session* s = *sit;
+ session::seventlist_t events = s->get_events ();
+
+ session::seventlist_t::iterator sit = events.begin ();
+ for (; sit != events.end (); ++sit)
+ {
+ sessionevent* sevent = *sit;
+ string event = sevent->get_name ();
+
+ if (eventlist.find (event) == eventlist.end ())
+ {
+ // New event -- new event, and new list of sessions
+ struct session_list_t* sl = (session_list_t*)malloc(sizeof(session_list_t*));
+ sl->default_sevent = NULL;
+ sl->sessions = new ordered_sessions_t;
+
+ //check if it's the default session
+ if (s->get_name() == DEFAULT_SESSION_NAME) {
+ sl->default_sevent = sevent;
+ } else {
+ sl->sessions->insert(sevent);
+ }
+
+ eventlist.insert (pair<string, session_list_t*> (event, sl));
+ }
+ else
+ {
+ // Known event -- add this session to the existing list for this event
+
+ //check if it's the default session
+ if (s->get_name() == DEFAULT_SESSION_NAME) {
+ eventlist[event]->default_sevent = sevent;
+ } else {
+ eventlist[event]->sessions->insert(sevent);
+ }
+ }
+ }
+ }
+
+ // Done compiling the list of events. Output information.
+ oxmlstream oxml (cout);
+ oxml << startt ("sessions");
+
+ if (!eventlist.empty ())
+ {
+ eventlist_t::iterator elit;
+ for (elit = eventlist.begin (); elit != eventlist.end (); ++elit)
+ {
+ string event = elit->first;
+
+ sessionevent* default_sevent = elit->second->default_sevent;
+ ordered_sessions_t* sessionlist = elit->second->sessions;
+
+ oxml << startt ("event") << attrt ("name", event);
+
+ if (default_sevent != NULL)
+ oxml << default_sevent;
+
+ copy (sessionlist->begin (), sessionlist->end (), ostream_iterator<sessionevent*> (oxml, ""));
+ oxml << endt;
+
+ if (default_sevent != NULL)
+ free(default_sevent);
+ delete sessionlist;
+ }
+ }
+
+ oxml << endt << endxml;
+
+ return EXIT_SUCCESS;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oxmlstream.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oxmlstream.h
new file mode 100644
index 0000000000..9166d4a01c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/oxmlstream.h
@@ -0,0 +1,27 @@
+/* oxmlstream.h - A convenience class for outputting XML.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _OXMLSTREAM_H
+#define _OXMLSTREAM_H
+#include <ostream>
+#include "xmlbuf.h"
+#include "xmlfmt.h"
+
+// An ostream which outputs in XML. See xmlfmt.h for XML operators.
+class oxmlstream : public std::ostream
+{
+ public:
+ // Constructor - pass ostream onto which XML should be output.
+ oxmlstream (std::ostream& os) : std::ostream (new xmlbuf (os)) {}
+ ~oxmlstream () { delete rdbuf (); }
+};
+#endif // ! _OXMLSTREAM_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.cc
new file mode 100644
index 0000000000..d0c34f8362
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.cc
@@ -0,0 +1,341 @@
+/* profileimage - A class which represents a single image for
+ which oprofile has samples (or for which some child dependency
+ has samples).
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2004,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "profileimage.h"
+
+#include <stdio.h>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <list>
+
+#include "sample.h"
+#include "imageheader.h"
+#include "xmlfmt.h"
+
+using namespace std;
+
+profileimage::profileimage (samplefile* sfile)
+ : _samplefile (sfile), _header (NULL)
+{
+ _dependencies = new list<profileimage*>;
+}
+
+profileimage::~profileimage ()
+{
+ delete _samplefile;
+ delete _dependencies;
+ if (_header != NULL)
+ delete _header;
+}
+
+// returns parsed_filename.image if top-level image
+// or parsed_filename.lib_image if dependency
+string
+profileimage::get_name (void) const
+{
+ if (!_samplefile->has_samplefile ())
+ {
+ // We have no sample file for this object -- look for
+ // the image name in the first dependency
+ list<profileimage*>::iterator i = _dependencies->begin ();
+ if (i != _dependencies->end ())
+ return (*i)->get_samplefile ()->get_image ();
+ else
+ {
+ // Can this happen? I don't think so, but...
+ cerr << "WARNING: empty profileimage at " << __FILE__
+ << ":" << __LINE__ << endl;
+ return "";
+ }
+ }
+
+ return _samplefile->get_name ();
+}
+
+long
+profileimage::get_count (void) const
+{
+ return _samplefile->get_sample_count ();
+}
+
+void
+profileimage::add_dependency (profileimage* image)
+{
+ _dependencies->push_back (image);
+}
+
+const imageheader*
+profileimage::get_header (void)
+{
+ if (_header == NULL)
+ {
+ samplefile* sfile;
+ if (_samplefile->has_samplefile ())
+ sfile =_samplefile;
+ else
+ {
+ // No samplefile -- use first dependency
+ list<profileimage*>::iterator i = _dependencies->begin ();
+ if (i != _dependencies->end ())
+ sfile = (*i)->get_samplefile ();
+ else
+ {
+ // Can this happen? I don't think so, but...
+ cerr << "WARNING: empty profileimage at " << __FILE__
+ << ":" << __LINE__ << endl;
+ return NULL;
+ }
+ }
+
+ _header = new imageheader (sfile);
+ }
+
+ return _header;
+}
+
+/*
+ * This loops through the samples and symbols for the image
+ * and organizes them in a top down manner so that they can
+ * be output as below:
+ *
+ *
+ * IMAGE name=""
+ * SYMBOL1 name="" file=""
+ * SAMPLE1 --\
+ * .. |-- this done by sample's operator<<
+ * SAMPLEN --/
+ * ..
+ * SYMBOLN
+ *
+ *
+ * Note that this will only output info if there are symbols
+ * for the specified image.
+ *
+ */
+ostream&
+operator<< (ostream& os, profileimage* image)
+{
+ samplefile* sfile;
+
+ if (image->get_samplefile ()->has_samplefile ())
+ {
+ sfile = image->get_samplefile();
+
+ //index the symbols by their bfd symbol
+ map<const asymbol*, symbol*> symbols;
+
+ //a list of samples collapsed by file & line number
+ list<sample*> samples_aggregated;
+
+ //get a list of samples from this image
+ samplefile::samples_t all_samples = sfile->get_samples();
+
+ //loop through samples, collapsing those with the same sample and line #
+ for (samplefile::samples_t::iterator i = all_samples.begin (); i != all_samples.end (); ++i)
+ {
+ const sample* smpl = samplefile::SAMPLE (*i);
+
+ if (smpl->has_symbol())
+ {
+ unsigned int line = 0;
+ const char* func = NULL;
+ const char* file = NULL;
+ sfile->get_debug_info (smpl->get_vma (), func, file, line);
+
+ //these are deleted in add_sample or at the end of this method
+ sample* new_sample = new sample(smpl->get_vma(), smpl->get_symbol(), smpl->get_count(), line);
+
+ add_sample(samples_aggregated, new_sample);
+ }
+ }
+
+ //loop through the samples, find all unique symbols
+ //add the sample to the symbol's list of samples
+ for (list<sample*>::iterator i = samples_aggregated.begin (); i != samples_aggregated.end (); ++i)
+ {
+ if ((*i)->has_symbol())
+ {
+ unsigned int line = 0;
+ const char* func = NULL;
+ const char* file = NULL;
+ sfile->get_debug_info ((*i)->get_vma (), func, file, line);
+
+ //deleted when output later
+ symbol* new_symbol = new symbol((*i)->get_symbol()->get_asymbol(), (file == NULL ? "" : file) );
+
+ //duplicates aren't inserted because of the unique asymbol*
+ symbols.insert(pair<const asymbol*, symbol*>(new_symbol->get_asymbol(),new_symbol));
+
+ //this symbol must be in the map, either it was just added or it was already there
+ symbols[(*i)->get_symbol()->get_asymbol()]->add_sample((*i));
+
+ //add to total count of the symbol
+ symbols[(*i)->get_symbol()->get_asymbol()]->add_count((*i)->get_count());
+ }
+ }
+
+ char buf[11];
+ long total_count = sfile->get_sample_count() + get_dependent_count(image->get_dependencies());
+ sprintf(buf,"%ld", total_count);
+
+ os << startt ("image")
+ << attrt ("name", get_name(image))
+ << attrt ("count", buf);
+
+ if (symbols.size() > 0) {
+ os << startt("symbols");
+
+ set<symbol*, symbol_comp>* sorted_symbols = sort_symbols(&symbols);
+
+ //output the symbols, and free their memory
+ for (set<symbol*, symbol_comp>::iterator i = sorted_symbols->begin(); i != sorted_symbols->end(); ++i)
+ {
+ os << *i;
+ delete *i;
+ }
+
+ os << endt; // </symbols>
+ sorted_symbols->clear();
+ symbols.clear();
+ }
+
+ //free the memory from the allocated samples
+ for (list<sample*>::iterator i = samples_aggregated.begin(); i != samples_aggregated.end(); ++i)
+ {
+// cerr << (*i)->get_demangled_name() << " " << (*i)->get_line() << " " << (*i)->get_count() << endl;
+ delete (*i);
+ }
+ samples_aggregated.clear();
+
+
+ //output dependent images
+ list<profileimage*>* deps = image->get_dependencies ();
+ if (!deps->empty())
+ {
+ char buf[21];
+ sprintf(buf,"%ld", get_dependent_count(deps));
+
+ os << startt ("dependent")
+ << attrt ("count", buf);
+
+ set<profileimage*, depimage_comp>* ordered_deps = sort_depimages(deps);
+
+ copy (ordered_deps->begin (), ordered_deps->end (), ostream_iterator<profileimage*> (os, ""));
+ os << endt;
+ }
+
+ os << endt; //</image>
+ }
+
+ return os;
+}
+
+//Adds the sample new_sample to the container samples.
+//
+//This method is required to collapse multiple samples that
+// occur on the same line, since one line can correspond to
+// more than one instructions and hence multiple samples
+// occur for the same line of code.
+void
+add_sample(list<sample*> &samples, sample* new_sample)
+{
+ bool added = false;
+
+ if (samples.size() == 0)
+ {
+ samples.push_back(new_sample);
+ }
+ else
+ {
+ for (list<sample*>::iterator i = samples.begin(); i != samples.end(); ++i)
+ {
+ //compare based on the symbols (bfd symbol ptr) and line number
+ if ((*i)->get_symbol()->get_asymbol() == new_sample->get_symbol()->get_asymbol() &&
+ (*i)->get_line() == new_sample->get_line())
+ {
+ //sample exists -- remove from vector, aggregate, reinsert
+ sample* s = new sample( (*i)->get_vma(),
+ (*i)->get_symbol(),
+ (*i)->get_count() + new_sample->get_count(),
+ (*i)->get_line());
+
+ delete (*i);
+ samples.erase(i);
+ samples.push_back(s);
+ added = true;
+ break;
+ }
+ }
+
+ if (!added)
+ {
+ samples.push_back(new_sample);
+ }
+ }
+}
+
+long
+get_dependent_count(const list<profileimage*>* const deps)
+{
+ long dep_count = 0;
+
+ //get total count for all the dependent images
+ for (list<profileimage*>::const_iterator i = deps->begin(); i != deps->end(); ++i)
+ {
+ dep_count += (*i)->get_samplefile()->get_sample_count();
+ }
+
+ return dep_count;
+}
+
+//special case name for VDSO
+string
+get_name(const profileimage* p)
+{
+ string name = p->get_name();
+
+ if (name == "")
+ {
+ //FIXME: any better way to do this?
+ if ((p->get_samplefile()->get_sample_file_name()).find("{anon:[vdso]}",0) != string::npos)
+ {
+ name = VDSO_NAME_STRING;
+ }
+ }
+
+ return name;
+}
+
+set<profileimage*, depimage_comp>*
+sort_depimages(const std::list<profileimage*>* const deps) {
+ set<profileimage*, depimage_comp>* sorted_deps = new set<profileimage*, depimage_comp>();
+ for (list<profileimage*>::const_iterator i = deps->begin(); i != deps->end(); ++i) {
+ sorted_deps->insert((*i));
+ }
+
+ return sorted_deps;
+}
+
+set<symbol*, symbol_comp>*
+sort_symbols(const std::map<const asymbol*, symbol*>* const symbols) {
+ set<symbol*, symbol_comp>* sorted_syms = new set<symbol*, symbol_comp>();
+
+ for (map<const asymbol*, symbol*>::const_iterator i = symbols->begin(); i != symbols->end(); ++i) {
+ sorted_syms->insert(i->second);
+ }
+
+ return sorted_syms;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.h
new file mode 100644
index 0000000000..2639a76b86
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/profileimage.h
@@ -0,0 +1,106 @@
+/* profileimage - A class which represents a single image for
+ which oprofile has samples (or for which some child dependency
+ has samples).
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2004,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _PROFILEIMAGE_H
+#define _PROFILEIMAGE_H
+
+#include <list>
+#include <string>
+#include <set>
+
+#include "samplefile.h"
+#include "symbol.h"
+
+#define VDSO_NAME_STRING "[vdso]"
+
+class sample;
+class imageheader;
+
+class profileimage
+{
+ public:
+ // Constructor - pass in the samplefile; CANNOT BE NULL.
+ profileimage (samplefile* sfile);
+
+ // Destructor
+ ~profileimage ();
+
+ // Returns the name of this image; it is the name of the actual binary
+ // in which samples were collected.
+ std::string get_name (void) const;
+
+ // Returns the image header for this image
+ const imageheader* get_header (void);
+
+ // Add the given profileimage as a dependency of this image
+ void add_dependency (profileimage* image);
+
+ // Returns a list of all the dependencies of this image
+ std::list<profileimage*>* get_dependencies (void) const { return _dependencies; };
+
+ // Returns the Oprofile samplefile for this image
+ samplefile* get_samplefile (void) const { return _samplefile; };
+
+ // Returns the count of all the samples collected in this image, excluding dependencies
+ long get_count (void) const;
+
+ private:
+ // The samplefile (non-NULL)
+ samplefile* _samplefile;
+
+ // List of dependencies
+ std::list<profileimage*>* _dependencies;
+
+ // Image header
+ imageheader* _header;
+};
+
+struct depimage_comp {
+ bool operator() (const profileimage* lhs, const profileimage* rhs)
+ {
+ if (lhs->get_count() == rhs->get_count())
+ if (lhs->get_name() == rhs->get_name())
+ return true;
+ else
+ return lhs->get_name() < rhs->get_name();
+ else
+ return lhs->get_count() > rhs->get_count();
+ }
+};
+
+struct symbol_comp {
+ bool operator() (const symbol* lhs, const symbol* rhs)
+ {
+ if (lhs->get_count() == rhs->get_count())
+ {
+ std::string ln(lhs->name()), rn(rhs->name());
+ if (ln == rn)
+ return true;
+ else
+ return ln < rn;
+ }
+ else
+ return lhs->get_count() > rhs->get_count();
+ }
+};
+
+
+std::ostream& operator<< (std::ostream& os, profileimage* image);
+void add_sample(std::list<sample*> &samples, sample* new_sample);
+long get_dependent_count(const std::list<profileimage*>* const deps);
+std::set<profileimage*, depimage_comp>* sort_depimages(const std::list<profileimage*>* const deps);
+std::set<symbol*, symbol_comp>* sort_symbols(const std::map<const asymbol*, symbol*>* const symbols);
+std::string get_name(const profileimage* p);
+#endif // !_PROFILEIMAGE_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.cc
new file mode 100644
index 0000000000..820b378fc1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.cc
@@ -0,0 +1,57 @@
+/* sample - A class which represents an Oprofile sample
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2004,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "sample.h"
+#include "xmlfmt.h"
+#include "symbol.h"
+
+using namespace std;
+
+// Constructor - pass in sample's address, any associated symbol, count,
+sample::sample(bfd_vma addr, symbol* sym, unsigned int count)
+ : _addr (addr), _symbol (sym), _count (count)
+{
+}
+
+sample::sample(bfd_vma addr, const symbol* sym, unsigned int count, unsigned int line)
+ : _addr (addr), _symbol (sym), _count (count), _line (line)
+{
+}
+
+const char*
+sample::get_name (void) const
+{
+ return (has_symbol () ? _symbol->name () : NULL);
+}
+
+const char*
+sample::get_demangled_name (void) const
+{
+ return (has_symbol () ? _symbol->demangled_name () : NULL);
+}
+
+/*
+ * <sample>
+ * <count>4312</count>
+ * <line>41</line>
+ * </sample>
+ */
+ostream&
+operator<< (ostream& os, const sample* s)
+{
+ os << startt ("sample")
+ << startt ("count") << s->get_count () << endt
+ << startt ("line") << s->get_line() << endt;
+
+ return os << endt;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.h
new file mode 100644
index 0000000000..f3940fe97f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sample.h
@@ -0,0 +1,78 @@
+/* Sample - A class which represents an Oprofile sample
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2003,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _SAMPLE_H
+#define _SAMPLE_H
+#include <stdlib.h>
+#include <bfd.h>
+#include <ostream>
+#include <set>
+
+
+class symbol;
+
+
+class sample
+{
+ public:
+ sample (bfd_vma a, symbol* sym, unsigned int cnt);
+ sample (bfd_vma a, const symbol* sym, unsigned int cnt, unsigned int line);
+
+ // Get the name of the symbol corresponding to this sample
+ // Returns NULL if no symbol.
+ const char* get_name (void) const;
+
+ // Returns the demangled name for this sample
+ const char* get_demangled_name (void) const;
+
+ // Returns the total sample count for this sample
+ inline unsigned int get_count(void) const { return _count; };
+
+ // Increments the total sample count for this sample
+ inline void incr_count (int n) { _count += n; };
+
+ // Does this sample have a symbol?
+ inline bool has_symbol (void) const { return _symbol != NULL; };
+
+ // Returns the symbol for this sample (could be NULL)
+ inline const symbol* get_symbol (void) const { return _symbol; };
+
+ // Gets the real vma for this sample
+ inline bfd_vma get_vma (void) const { return _addr; };
+
+ inline unsigned int get_line() const { return _line; };
+
+ private:
+ // (real) Address of sample
+ bfd_vma _addr;
+
+ // Symbol for sample (according to minimal symbols)
+ const symbol* _symbol;
+
+ // Number of times sample appears in output
+ unsigned int _count;
+
+ //line number -- set in profileimage
+ unsigned int _line;
+
+};
+
+
+struct sample_comp {
+ bool operator() (const sample* lhs, const sample* rhs) { return (lhs->get_count() == rhs->get_count() ? lhs->get_line() < rhs->get_line() : lhs->get_count() > rhs->get_count() ); }
+};
+
+
+// Operator to output samples
+std::ostream& operator<< (std::ostream& os, const sample* s);
+#endif // !_SAMPLE_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.cc
new file mode 100644
index 0000000000..2bc55d8477
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.cc
@@ -0,0 +1,248 @@
+/* samplefile - A class which represents a samplefile. This class either
+ represents a real disk file or a "fake" one (needed in cases where
+ Oprofile only collected samples in a dependency, like a library).
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "samplefile.h"
+#include "sample.h"
+#include "stable.h"
+#include "xmlfmt.h"
+
+#include <algorithm>
+
+using namespace std;
+
+// From libutil++
+extern bool create_file_list (list<string>& file_list, const string& base_dir,
+ const string& filter = "*", bool recursive = true);
+
+samplefile::samplefile (string filename)
+{
+ _st = NULL;
+ _db = new oprofile_db (filename);
+ _filename = filename;
+ _get_info_from_filename ();
+}
+
+// This seems like a giant waste of time, but when it comes down to processing many
+// hundreds of samplefiles, we really need to be able to do this quickly.
+string
+samplefile::event_for_filename (string filename)
+{
+ string event;
+
+ string::size_type pos = filename.find_last_of ('/');
+ if (pos != string::npos)
+ {
+ string basename = filename.substr (pos + 1, string::npos);
+
+ // Tokenize the basename between the '.'. This seems like a contradiction
+ // to the speed mantra, but consider it a minimal sanity check.
+ vector<string> parts = _tokenize (basename, '.');
+ if (parts.size () == 6)
+ event = parts[0];
+ }
+
+ return event;
+}
+
+void
+samplefile::_get_info_from_filename (void)
+{
+ // First the easy stuff: event specifications
+ // Filenames look like: EVENT.COUNT.UMASK.TGID.TID.CPU
+ string basename;
+ string dir_name;
+ string::size_type pos = _filename.find_last_of ('/');
+ if (pos != string::npos)
+ {
+ dir_name = _filename.substr (0, pos);
+ basename = _filename.substr (pos + 1, string::npos);
+
+ // Tokenize the basename between the '.'
+ vector<string> parts = _tokenize (basename, '.');
+ if (parts.size () == 6)
+ {
+ // Right number of specifications!
+ int i = 0;
+ _event = parts[i++];
+ _count = parts[i++];
+ _unit_mask = parts[i++];
+ _tgid = parts[i++];
+ _tid = parts[i++];
+ _cpu = parts[i++];
+ }
+ else
+ return ;
+
+ /* Now the hard part: the lib and image names */
+
+ // Like the event spec, the easiest way to do this is to tokenize the pathname
+ parts = _tokenize (dir_name, '/');
+
+ // Strip off everything up to either "{root}" or "{kern}"
+ vector<string>::size_type i = 0;
+
+ /* Basically, we have
+ "/path/to/samples/<session>/{root} or {kern}"
+ + "/path/to/executable/{dep}" + "{root}" || "{kern}"
+ + "/path/to/library[/{cg}]
+ [+ "/path/to/callgraph"] */
+
+ // First "token" to look for is "{root}" or "{kern}"
+ for ( ; i < parts.size (); ++i)
+ {
+ if (parts[i] == "{root}" || parts[i] == "{kern}")
+ break;
+ }
+
+ // Skip past "{root}" or "{kern}"
+ ++i;
+
+ // Next "token" is "{dep}". Everything else is image name
+ for ( ; i < parts.size () && parts[i] != "{dep}"; ++i)
+ _image += "/" + parts[i];
+
+ // Skip past "{dep}"
+ ++i;
+
+ // "{dep}" must be followed by "{kern}" or "{root}"
+ if (parts[i] != "{kern}" && parts[i] != "{root}")
+ {
+ // Error. Filename truncated.
+ return;
+ }
+
+ // Skip past "{kern}" or "{root}"
+ ++i;
+
+ // Next "token" will be "{cg}" or string::npos
+ for ( ; i < parts.size () && parts[i] != "{cg}"; ++i)
+ _lib_image += "/" + parts[i];
+
+ // Skip past "{cg}" (or end)
+ ++i;
+
+ // Last bits will be callgraph
+ for ( ; i < parts.size (); ++i)
+ _callgraph += "/" + parts[i];
+ }
+}
+
+vector<string>
+samplefile::_tokenize (const string& str, char delim)
+{
+ vector<string> tokens;
+ string::size_type start, end;
+
+ start = end = 0;
+ while ((end = str.find (delim, start)) != string::npos)
+ {
+ if (start != end ) // ignore zero-length, i.e, str[0] == delim
+ tokens.push_back (str.substr (start, end - start));
+
+ // skip the delimiter character
+ start = end + 1;
+ }
+
+ // add any trailing stuff
+ if (start != str.length ())
+ tokens.push_back (str.substr (start, string::npos));
+
+ return tokens;
+}
+
+samplefile::~samplefile (void)
+{
+ if (_db != NULL)
+ {
+ delete _db;
+ _db = NULL;
+ }
+
+ if (_st != NULL)
+ {
+ delete _st;
+ _st = NULL;
+ }
+}
+
+// DO NOT FREE THE RESULT. ~oprofile_db will do it.
+const samplefile::samples_t
+samplefile::get_samples (void)
+{
+ samplefile::samples_t samples;
+
+ if (has_samplefile ())
+ {
+ if (_st == NULL)
+ {
+ _st = new symboltable (get_name ().c_str ());
+ _st->read_symbols ();
+ }
+
+ samples = _db->get_samples (_st);
+ }
+
+ return samples;
+}
+
+bool
+samplefile::get_debug_info (bfd_vma vma, const char*& func, const char*& file, unsigned int& line)
+{
+ return (_st == NULL ? false : _st->get_debug_info (vma, func, file, line));
+}
+
+void
+samplefile::get_sample_file_list (list<string>& file_list, const string& base_dir)
+{
+ file_list.clear ();
+
+ list<string> files;
+ if (create_file_list (files, base_dir))
+ {
+ list<string>::iterator i;
+ for (i = files.begin (); i != files.end (); ++i)
+ {
+ // Only allow unique filenames into the final list.
+ // (This can happen because we can have multiple counters
+ // for any given sample file.)
+ if (find (file_list.begin (), file_list.end (), *i)
+ == file_list.end ())
+ file_list.push_back (*i);
+ }
+ }
+}
+
+// Output header & list of samples
+/*
+ * <samplefile>/var/lib/oprofile/samples/current/blah/blah/blah</samplefile>
+ * SAMPLE (handled by class sample)
+ */
+ostream&
+operator<< (ostream& os, samplefile* sf)
+{
+ // output the sfile's full pathname (used for fetching debug info)
+ os << startt ("samplefile") << sf->get_sample_file_name () << endt;
+
+ // output list of samples
+ //TODO: grouped by symbol, then line number
+ samplefile::samples_t samples = sf->get_samples ();
+ samplefile::samples_t::iterator s;
+ for (s = samples.begin (); s != samples.end (); ++s)
+ {
+ const sample* smpl = samplefile::SAMPLE (*s);
+ os << smpl;
+ }
+
+ return os;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.h
new file mode 100644
index 0000000000..90ca91c6ec
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/samplefile.h
@@ -0,0 +1,140 @@
+/* samplefile - A class which represents a samplefile. This class either
+ represents a real disk file or a "fake" one (needed in cases where
+ Oprofile only collected samples in a dependency, like a library).
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _SAMPLEFILE_H
+#define _SAMPLEFILE_H
+#include <string>
+#include <list>
+#include <vector>
+
+#include "oprofiledb.h"
+
+class symboltable;
+
+class samplefile
+{
+ public:
+ // The type of a list of samples. STL container with iterators.
+ typedef oprofile_db::samples_t samples_t;
+
+ // The type of a sample. Also an STL container. Use SAMPLE to get at
+ // actual sample.
+ typedef oprofile_db::sample_t sample_t;
+
+ // The type of a list of samplefiles
+ typedef std::list<samplefile*> samplefilelist_t;
+
+ // Convenience function to return the sample associated with
+ // a sample_t
+ static inline sample* SAMPLE (sample_t sample)
+ { return oprofile_db::SAMPLE (sample); };
+
+ // Constructor -- pass in the filename (may be "" when there
+ // were no samples collected for the profileimage, i.e., "fake").
+ samplefile (std::string filename);
+
+ // Destructor
+ ~samplefile (void);
+
+ // Does this sample have a samplefile? This happens when Oprofile has
+ // collected samples for an image, but all those samples were collected
+ // in libraries and other dependencies.
+ bool has_samplefile (void) const
+ { return _filename != ""; };
+
+ // Is this samplefile a dependency?
+ bool is_dependency (void) const
+ { return (!has_samplefile () || (_image != _lib_image)); }
+
+ // Get count of all samples in this file
+ long get_sample_count (void)
+ { return (has_samplefile () ? _db->get_count () : 0); };
+
+ // Returns the filename of this samplefile (or "" if it is "fake")
+ std::string get_sample_file_name (void) const
+ { return _filename; };
+
+ // Returns the image name
+ std::string get_image (void) const
+ { return _image; };
+
+ // Returns the library image name
+ std::string get_lib_image (void) const
+ {return _lib_image; };
+
+ // Returns the logical name of the image in this samplefile, i.e.,
+ // the lib_image if this is a dependency or image_name if not
+ std::string get_name (void) const
+ { return (is_dependency () ? get_lib_image () : get_image ()); };
+
+ // Returns the event name that was collected in this samplefile
+ std::string get_event (void) const
+ { return _event; };
+
+ std::string get_count (void) const
+ { return _count; };
+
+ std::string get_unit_mask (void) const
+ { return _unit_mask; };
+
+ std::string get_tgid (void) const
+ { return _tgid; };
+
+ std::string get_tid (void) const
+ { return _tid; };
+
+ std::string get_cpu (void) const
+ { return _cpu; };
+
+ std::string get_callgraph (void) const
+ { return _callgraph; };
+
+ // Returns a list of all the samples in this samplefile. Do NOT free the result!
+ const samples_t get_samples (void);
+
+ // Returns the debug info for the given VMA.
+ bool get_debug_info (bfd_vma vma, const char*& func, const char*& file, unsigned int& line);
+
+ // Get list of files from base_dir
+ static void get_sample_file_list (std::list<std::string>& file_list,
+ const std::string& base_dir);
+
+ // This may seem like a bad practice, but this is done for speed reasons
+ static std::string event_for_filename (std::string filename);
+
+ private:
+ static std::vector<std::string> _tokenize (const std::string& str, char delim);
+ void _get_info_from_filename (void);
+
+ // The oprofile_db associated with this samplefile
+ oprofile_db* _db;
+
+ // The symbol table opened for the executable represented by this samplefile
+ symboltable* _st;
+
+ // Information about the collection configuration
+ std::string _filename; // Disk filename of samplefile
+ std::string _image; // Name of the image recorded
+ std::string _lib_image; // Name of the library (== _image if not a sub-image)
+ std::string _event;
+ std::string _count;
+ std::string _unit_mask;
+ std::string _tgid;
+ std::string _tid;
+ std::string _cpu;
+ std::string _callgraph;
+};
+
+std::ostream& operator<< (std::ostream& os, samplefile* sf);
+#endif // !_SAMPLEFILE_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.cc
new file mode 100644
index 0000000000..7b2bc44d8b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.cc
@@ -0,0 +1,203 @@
+/* session - a class which represents an oprofile session.
+ All sessions occur as directories of the samples directory.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "session.h"
+#include <iostream>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+
+#include "sevent.h"
+#include "opinfo.h"
+#include "xmlfmt.h"
+
+using namespace std;
+
+session::session(string name, const opinfo* info)
+ : _name (name), _info (info)
+{
+}
+
+string
+session::get_base_directory (void) const
+{
+ return _info->get_samples_directory () + _name;
+}
+
+session::sessionlist_t
+session::get_sessions (const opinfo& info)
+{
+ sessionlist_t sessions;
+
+ struct stat sbuf;
+ int rc = stat (info.get_samples_directory ().c_str (), &sbuf);
+ if (rc < 0)
+ {
+ cerr << "cannot stat samples directory (" << info.get_samples_directory () << ")"
+ << endl;
+ return sessions;
+ }
+ else if (S_ISDIR (sbuf.st_mode) == 0)
+ {
+ cerr << "samples directory (" << info.get_samples_directory ()
+ << ") is not a directory" << endl;
+ return sessions;
+ }
+
+ DIR* dirp = opendir (info.get_samples_directory ().c_str ());
+ if (dirp == NULL)
+ {
+ cerr << "cannot read samples directory (" << info.get_samples_directory () << ")"
+ << endl;
+ return sessions;
+ }
+
+ struct dirent* dir;
+ while ((dir = readdir (dirp)) != NULL)
+ {
+ if (strcmp (dir->d_name, ".") != 0 && strcmp (dir->d_name, "..") != 0)
+ {
+ string name (dir->d_name);
+ sessions.push_back (new session (name, &info));
+ }
+ }
+
+ return sessions;
+}
+
+// returns NULL if not found
+sessionevent*
+session::get_event (string event_name)
+{
+ list<string> filelist;
+ samplefile::get_sample_file_list (filelist, get_base_directory ());
+
+ // Loop through all sample files, create & populate sessionevents
+ // with sample file lists
+ sessionevent* the_sevent = NULL;
+ list<samplefile*> deps;
+ list<string>::iterator fit = filelist.begin ();
+ for (; fit != filelist.end (); ++fit)
+ {
+ if (samplefile::event_for_filename (*fit) == event_name)
+ {
+ samplefile* sfile = new samplefile (*fit);
+
+ if (!sfile->is_dependency ())
+ {
+ // main image
+ if (the_sevent == NULL)
+ {
+ // found the desired event -- create it
+ the_sevent = new sessionevent (this, event_name);
+ }
+
+ // Add this sample file to the sessionevent
+ the_sevent->add_sample_file (sfile);
+ }
+ else
+ {
+ // dependency -- save it for later resolution
+ deps.push_back (sfile);
+ }
+ }
+ }
+
+ // Now run through the list of dependencies
+ if (the_sevent != NULL)
+ {
+ list<samplefile*>::iterator sfit;
+ for (sfit = deps.begin (); sfit != deps.end (); ++sfit)
+ {
+ samplefile* sfile = *sfit;
+ the_sevent->add_sample_file (sfile);
+ }
+ }
+
+ return the_sevent;
+}
+
+
+
+session::seventlist_t
+session::get_events ()
+{
+ list<string> filelist;
+ samplefile::get_sample_file_list (filelist, get_base_directory ());
+
+ // Loop through all sample files, create & populate sessionevents
+ // with sample file lists
+ seventlist_t events;
+ map<string, sessionevent*> emap;
+ list<samplefile*> deps;
+ list<string>::iterator fit = filelist.begin ();
+ for (; fit != filelist.end (); ++fit)
+ {
+ if (samplefile::event_for_filename (*fit) != "")
+ {
+ samplefile* sfile = new samplefile (*fit);
+ if (!sfile->is_dependency ())
+ {
+ // main image
+ map<string, sessionevent*>::iterator item;
+ item = emap.find (sfile->get_event ());
+ if (item == emap.end ())
+ {
+ // new event -- create sessionevent
+ sessionevent* se = new sessionevent (this, sfile->get_event ());
+
+ // Save this sessionevent in the event map
+ emap.insert (make_pair<string, sessionevent*> (sfile->get_event (), se));
+
+ // Add this sample file to the list
+ se->add_sample_file (sfile);
+
+ // Finally, add this new sessionevent to result
+ events.push_back (se);
+ }
+ else
+ {
+ // Add this sample file to the sessionevent
+ sessionevent* se = (*item).second;
+ se->add_sample_file (sfile);
+ }
+ }
+ else
+ {
+ // dependency -- save it for later resolution
+ deps.push_back (sfile);
+ }
+ }
+ }
+
+ // Now run through the list of dependencies
+ list<samplefile*>::iterator sfit;
+ for (sfit = deps.begin (); sfit != deps.end (); ++sfit)
+ {
+ samplefile* sfile = *sfit;
+ map<string, sessionevent*>::iterator item;
+ item = emap.find (sfile->get_event ());
+ if (item != emap.end ())
+ {
+ sessionevent* se = (*item).second;
+ se->add_sample_file (sfile);
+ }
+ else
+ cerr << "WARNING! dep file with no event!" << endl;
+ }
+
+ return events;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.h
new file mode 100644
index 0000000000..337114096e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/session.h
@@ -0,0 +1,59 @@
+/* session - a class which represents an oprofile session.
+ All sessions occur as directories of the samples directory.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _SESSION_H
+#define _SESSION_H
+#include <string>
+#include <list>
+
+#include "samplefile.h"
+
+class opinfo;
+class sessionevent;
+
+class session
+{
+ public:
+ // Constructor - pass in the name of the session (or "" for the default)
+ // and cpu/config information
+ session (std::string name, const opinfo* info);
+
+ // Returns a list of all sessions
+ typedef std::list<session*> sessionlist_t;
+ static sessionlist_t get_sessions (const opinfo& info);
+
+ // Returns the name of this session
+ const std::string& get_name (void) const { return _name; };
+
+ // Returns a list of events collected in this session.
+ typedef std::list<sessionevent*> seventlist_t;
+ seventlist_t get_events ();
+
+ // Searches for and returns the sessionevent which collected the
+ // given event_name. Returns NULL if not found. Return value must be
+ // freed by caller.
+ sessionevent* get_event (std::string event_name);
+
+ // Returns the directory for this session, i.e., SAMPLES_DIR+session_name
+ std::string get_base_directory (void) const;
+
+ private:
+ // The name of this session
+ std::string _name;
+
+ // The cpu info
+ const opinfo* _info;
+};
+
+
+#endif // !_SESSION_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.cc
new file mode 100644
index 0000000000..34496ef80a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.cc
@@ -0,0 +1,105 @@
+/* sevent (sessionevent) - a class which represents an event collected
+ within an oprofile session. There will be one sessionevent for every
+ event collected within a session. No two sessionevents with the same
+ session name may have the same event name.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "sevent.h"
+
+#include "session.h"
+#include "xmlfmt.h"
+
+using namespace std;
+
+sessionevent::sessionevent (const session* session, string event)
+ : _session (session), _event_name (event)
+{
+ _files = new profileimages_t;
+}
+
+sessionevent::~sessionevent ()
+{
+ profileimages_t::iterator it;
+ for (it = _files->begin (); it != _files->end (); ++it)
+ delete (*it);
+ delete _files;
+}
+
+void
+sessionevent::add_sample_file (samplefile* sfile)
+{
+ if (!sfile->is_dependency ())
+ {
+ // top-level image
+ _files->push_back (new profileimage (sfile));
+
+ }
+ else
+ {
+ // find file -- add dependent
+ bool found = false;
+ profileimages_t::iterator it;
+ for (it = _files->begin (); it != _files->end (); ++it)
+ {
+ if ((*it)->get_name () == sfile->get_image ())
+ {
+ (*it)->add_dependency (new profileimage (sfile));
+ found = true;
+ }
+ }
+
+ if (!found)
+ {
+ // This does happen!! We got no samples in a profileimage,
+ // but we DID get samples in a dependency. Create a new
+ // "fake" profileimage and add this as a dependency.
+ profileimage* img = new profileimage (new samplefile (""));
+ img->add_dependency (new profileimage (sfile));
+ _files->push_back (img);
+ }
+ }
+}
+
+long
+sessionevent::get_count (void) const
+{
+ // Get list of images
+ profileimages_t::iterator it;
+ long count = 0;
+ for (it = _files->begin (); it != _files->end (); ++it)
+ {
+ // Get count of the main image
+ count += (*it)->get_count ();
+
+ // Add count for dependencies
+ list<profileimage*>* deps = (*it)->get_dependencies ();
+ list<profileimage*>::iterator dit;
+ for (dit = deps->begin (); dit != deps->end (); ++dit)
+ count += (*dit)->get_count ();
+ }
+
+ return count;
+}
+
+/*
+ * <session name="foo">
+ * <count>1234</count>
+ * </session>
+ *
+ */
+ostream&
+operator<< (ostream& os, const sessionevent* se)
+{
+ return os << startt ("session") << attrt ("name", se->get_session ()->get_name ())
+// << startt ("count") << se->get_count () << endt
+ << endt;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.h
new file mode 100644
index 0000000000..afcb15c8d2
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/sevent.h
@@ -0,0 +1,63 @@
+/* sevent (sessionevent) - a class which represents an event collected
+ within an oprofile session. There will be one sessionevent for every
+ event collected within a session. No two sessionevents with the same
+ session name may have the same event name.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _SEVENT_H
+#define _SEVENT_H
+#include <string>
+#include <list>
+
+#include "profileimage.h"
+
+class samplefile;
+class session;
+
+class sessionevent
+{
+ public:
+ // Constructor -- pass in session and event name
+ sessionevent (const session* session, std::string event);
+
+ // Desctructor
+ ~sessionevent ();
+
+ // Returns the event name
+ const std::string get_name (void) const { return _event_name; };
+
+ // Returns the session
+ const session* get_session (void) const { return _session; };
+
+ // Adds the samplefile to this sessionevent
+ void add_sample_file (samplefile* sfile);
+
+ // Returns the count of all samples in this sessionevent
+ long get_count (void) const;
+
+ // Returns a list of the images in the sessionevent
+ typedef std::list<profileimage*> profileimages_t;
+ profileimages_t* get_images (void) const { return _files; };
+
+ private:
+ // The session
+ const session* _session;
+
+ // The name of the event
+ const std::string _event_name;
+
+ // A list of images in this session
+ profileimages_t* _files;
+};
+
+std::ostream& operator<< (std::ostream& os, const sessionevent* se);
+#endif // _SEVENT_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.cc
new file mode 100644
index 0000000000..5f9e63bfac
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.cc
@@ -0,0 +1,294 @@
+/* symboltable - A symbol table class
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <stdlib.h>
+#include <string.h>
+#include <iostream>
+#include <fcntl.h>
+#include <algorithm>
+
+#include "stable.h"
+#include "symbol.h"
+
+static bool ltvma (const symbol* a, const symbol* b);
+
+// Stolen from oprofile
+char const* symboltable::_boring_symbols[] = {
+ "gcc2_compiled.",
+ "_init"
+};
+
+// Helper function for sorting symbols by VMA
+static bool
+compare_symbol_with_vma (bfd_vma vma, const symbol* a)
+{
+ return (a->end () > vma);
+}
+
+symboltable::symboltable(const char* file)
+ : _filename (strdup (file)), _abfd (NULL), _symbol_table (NULL), _cache_symbol (NULL)
+{
+}
+
+symboltable::~symboltable ()
+{
+ if (_symbol_table != NULL)
+ free (_symbol_table);
+
+ std::vector<symbol*>::iterator i = _symbols.begin ();
+ while (i != _symbols.end ())
+ {
+ delete (*i);
+ //_symbols.erase (i);
+ ++i;
+ }
+
+ _symbols.clear ();
+ _close_bfd ();
+ free (_filename);
+}
+
+// If this returns NULL, then the VMA is not in any range of
+// msymbols. This is can apparently happen. op_time and friends
+// ignore these samples.
+symbol*
+symboltable::lookup_vma (bfd_vma vma, bfd_vma& real_vma, bool is_kernel)
+{
+ if (is_kernel)
+ real_vma = vma;
+ else
+ real_vma = vma + _start_vma - _text_offset;
+ return (lookup_vma (real_vma));
+}
+
+symbol*
+symboltable::lookup_vma (bfd_vma real_vma)
+{
+ if (_cache_symbol != NULL && _cache_symbol->contains (real_vma))
+ return _cache_symbol;
+
+ std::vector<symbol*>::iterator i;
+ i = upper_bound (_symbols.begin (), _symbols.end (),
+ real_vma, compare_symbol_with_vma);
+ if (i != _symbols.end () && (*i)->contains (real_vma))
+ {
+ _cache_symbol = *i;
+ return *i;
+ }
+
+ return NULL;
+}
+
+bool
+symboltable::read_symbols ()
+{
+ if (_open_bfd ())
+ {
+ long storage_needed = bfd_get_symtab_upper_bound (_abfd);
+ if (storage_needed > 0)
+ {
+ _symbol_table = (asymbol**) malloc (storage_needed);
+ long num_symbols = bfd_canonicalize_symtab (_abfd, _symbol_table);
+ for (int i = 0; i < num_symbols; ++i)
+ {
+ if (_interesting_symbol (_symbol_table[i]))
+ _symbols.push_back (new symbol (_symbol_table[i]));
+ }
+
+ if (_symbols.size() > 0)
+ {
+ // Sort in order of increasing vma and eliminate duplicates
+ stable_sort (_symbols.begin (), _symbols.end (), ltvma);
+
+ // Eliminate duplicates
+ for (size_t i = 0; i < _symbols.size () - 1; ++i)
+ {
+ if (_symbols[i]->start () == _symbols[i+1]->start ())
+ {
+ int erase;
+
+ // Opt to keep FUNCTIONs, first come, first kept
+ if (_symbols[i]->flags () & BSF_FUNCTION)
+ erase = i + 1;
+ else if (_symbols[i+1]->flags () & BSF_FUNCTION)
+ erase = i;
+ else // Don't know. Keep first.
+ erase = i + 1;
+
+ delete *(_symbols.begin () + erase);
+ _symbols.erase (_symbols.begin () + erase);
+ --i;
+ }
+ }
+
+ // Fill in end addresses
+ for (size_t i = 0; i <= _symbols.size () - 1; ++i)
+ {
+ asymbol* this_sym;
+ asymbol* next_sym = NULL;
+ asection* this_sect;
+ asection* next_sect;
+
+ this_sym = _symbols[i]->get_asymbol ();
+ this_sect = bfd_get_section (this_sym);
+ if (i < _symbols.size () - 1)
+ {
+ next_sym = _symbols[i + 1]->get_asymbol ();
+ next_sect = bfd_get_section (next_sym);
+ }
+ else
+ next_sect = NULL;
+
+ if (next_sect != NULL
+ && bfd_get_section (this_sym) == bfd_get_section (next_sym))
+ _symbols[i]->end (_symbols[i + 1]->start ());
+ else
+ {
+ asection* asect = bfd_get_section (this_sym);
+ bfd_vma end = bfd_get_section_vma (_abfd, asect);
+ end += bfd_section_size (_abfd, asect);
+ _symbols[i]->end (end);
+ }
+ }
+
+ return true;
+ }
+ }
+ /* This may not seem correct, since we're pasing pointers of asymbols
+ and the like to other pieces of opxml (class symbol, in particular),
+ but remember that we've allocated memory for the symbol table earlier,
+ and class symbol references that. So as long as the object "class symboltable"
+ is not deleted, all symbols will be valid, and we can close the bfd. */
+ _close_bfd ();
+ }
+
+ return false;
+}
+
+bool
+symboltable::_interesting_symbol (asymbol* sym)
+{
+ if (!(bfd_get_section_flags (bfd_asymbol_bfd (sym), bfd_get_section (sym)) & SEC_CODE))
+ return false;
+
+ const char* name = bfd_asymbol_name (sym);
+ if (name == NULL || name[0] == '\0')
+ return false;
+
+ // C++ exception stuff
+ if (name[0] == '.' && name[1] == 'L')
+ return false;
+
+ for (size_t i = 0; i < sizeof (_boring_symbols) / sizeof (_boring_symbols[0]); i++)
+ {
+ if (strcmp (name, _boring_symbols[i]) == 0)
+ return false;
+ }
+
+ return true;
+}
+
+bool
+symboltable::_open_bfd (void)
+{
+ if (_abfd == NULL)
+ {
+ bfd_init ();
+ int fd = open (_filename, O_RDONLY); // bfd_close will close fd
+ _abfd = bfd_fdopenr (_filename, NULL, fd);
+ if (_abfd != NULL)
+ {
+ char** matches;
+ if (bfd_check_format_matches (_abfd, bfd_object, &matches))
+ {
+ asection const* sect;
+
+ sect = bfd_get_section_by_name(_abfd, ".text");
+ if (sect != NULL) {
+ _text_offset = sect->filepos;
+ } else {
+ return false;
+ }
+
+// //fail: this might not get the text section because
+// // other sections may also have the SEC_CODE flag
+// for (sect = _abfd->sections; sect != NULL; sect = sect->next)
+// {
+// if (sect->flags & SEC_CODE)
+// {
+// _text_offset = sect->filepos;
+// break;
+// }
+// }
+
+ }
+
+ _start_vma = bfd_get_start_address (_abfd);
+ }
+ }
+ return (_abfd != NULL);
+}
+
+void
+symboltable::_close_bfd (void)
+{
+ if (_abfd != NULL)
+ bfd_close (_abfd);
+
+ _abfd = NULL;
+}
+
+bool
+symboltable::get_debug_info (bfd_vma vma, const char*& function,
+ const char*& source_file, unsigned int& line)
+{
+ function = NULL;
+ source_file = NULL;
+ line = 0;
+
+ symbol* symbol = lookup_vma (vma);
+ if (symbol != NULL)
+ {
+ asection* asection = symbol->section ();
+
+ bfd_vma pc = vma - bfd_get_section_vma (_abfd, asection);
+ return bfd_find_nearest_line (_abfd, asection, _symbol_table, pc,
+ &source_file, &function, &line);
+ }
+
+
+ return false;
+}
+
+#if 0
+void
+symboltable::dump_table (void)
+{
+ printf ("%8s\t%8s\t%s\n", "start", "end", "name");
+
+ std::vector<symbol*>::iterator i;
+ for (i = _symbols.begin (); i != _symbols.end (); ++i)
+ {
+ symbol* sym = *i;;
+ printf("%8x\t%8x\t%s\n", (unsigned int)sym->start (), (unsigned int)sym->end (),
+ sym->name ());
+ }
+}
+#endif
+
+// Helper function to sort two symbols based on VMA
+static bool
+ltvma (const symbol* a, const symbol* b)
+{
+ return (a->start () < b->start ());
+}
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.h
new file mode 100644
index 0000000000..e82dd72766
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/stable.h
@@ -0,0 +1,87 @@
+/* symboltable - A symbol table class
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2004 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _STABLE_H
+#define _STABLE_H
+#include <bfd.h>
+#include <vector>
+
+class symbol;
+
+class symboltable
+{
+ public:
+ symboltable (const char* file);
+ ~symboltable (void);
+
+ // Lookup a Symbol for the given sample vma. Returns the symbol found (or NULL)
+ // and gives the real address of the sample. Sadly, kernel images are treated
+ // differently from userspace images.
+ symbol* lookup_vma (bfd_vma sample_vma, bfd_vma &real_address, bool is_kernel);
+ symbol* lookup_vma (bfd_vma real_vma);
+
+ // Read in the samples
+ bool read_symbols (void);
+
+ inline asymbol** get_bfd_symbol_table (void) const { return _symbol_table; };
+
+ /* Gets the debug info for a given address:
+ function name in debug info
+ source filename
+ line number
+
+ Returns true if debug info found. False otherwise.
+ NOTE: could return true but still have source_file and line be
+ invalid!*/
+ bool get_debug_info (bfd_vma vma, const char*& function,
+ const char*& source_file, unsigned int& line);
+
+#if 0
+ // Debugging. Dump the symbol table
+ void dump_table (void);
+#endif
+
+ protected:
+ // Opens the BFD associated with the executable
+ bool _open_bfd (void);
+
+ // Closes the BFD
+ void _close_bfd (void);
+
+ // Helper function: is the given asymbol "interesting"? (i.e., should
+ // it go into the symbol table?)
+ static bool _interesting_symbol (asymbol* sym);
+
+ // A list of known uninteresting symbols
+ static char const* _boring_symbols[];
+
+ // All of the executable's symbols
+ std::vector<symbol*> _symbols;
+
+ // The executable's filename
+ char* _filename;
+
+ // The BFD associated with this executable
+ bfd* _abfd;
+
+ // The BFD symbol table
+ asymbol** _symbol_table;
+
+ // The physical load address of this executable (NOT THE BFD SECTION
+ // START ADDRESS)
+ bfd_vma _start_vma;
+ bfd_vma _text_offset;
+
+ // A performance cache
+ symbol* _cache_symbol;
+};
+#endif // !_STABLE_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.cc
new file mode 100644
index 0000000000..478805d8da
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.cc
@@ -0,0 +1,85 @@
+/* symbol - A class which represents symbols in executables
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2003,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "symbol.h"
+#include "xmlfmt.h"
+
+// From libiberty
+#ifndef DMGL_PARAMS
+#define DMGL_PARAMS (1 << 0) // Include function arguments
+#endif
+
+#ifndef DMGL_ANSI
+#define DMGL_ANSI (1 << 1) // Include const, volatile, etc
+#endif
+
+using namespace std;
+
+extern "C" char* cplus_demangle (char const* mangled_name, int options);
+
+const bfd_vma symbol::UNSET = (bfd_vma) -1;
+
+
+symbol::symbol (asymbol* sym)
+ : _end (UNSET), _asymbol (sym)
+{
+ _count = 0;
+}
+
+symbol::symbol (asymbol* sym, string src_filename)
+ : _end (UNSET), _asymbol (sym), _src_filename(src_filename)
+{
+ _count = 0;
+}
+
+bool
+symbol::contains (bfd_vma addr) const
+{
+ if (addr >= start() && addr < _end)
+ return true;
+ return false;
+}
+
+const char*
+symbol::demangled_name (void) const
+{
+ char* demangled = cplus_demangle (name (), DMGL_PARAMS | DMGL_ANSI);
+ if (demangled == NULL)
+ return name ();
+
+ return demangled;
+}
+
+ostream&
+operator<< (ostream& os, const symbol* s)
+{
+ //convert symbol's total count to a string for attrt
+ char buf[11];
+ sprintf(buf,"%u",s->get_count());
+
+ //output this symbol's info
+ os << startt ("symbol")
+ << attrt ("name", s->demangled_name ())
+ << attrt ("file", s->get_srcfilename())
+ << attrt ("count", buf);
+
+ //ouput all samples under this symbol
+ const std::set<sample*, sample_comp>* samples = s->get_sample_list();
+ for (std::set<sample*, sample_comp>::iterator i = samples->begin(); i != samples->end(); ++i)
+ os << (*i);
+
+ return os << endt;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.h
new file mode 100644
index 0000000000..a9a9112378
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/symbol.h
@@ -0,0 +1,97 @@
+/* symbol - A class which represents symbols in executables
+ Written by Keith Seitz <keiths@redhat.com>
+ Edited by Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2003,2008 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _SYMBOL_H
+#define _SYMBOL_H
+
+#include <ostream>
+#include <bfd.h>
+#include <set>
+
+#include "sample.h"
+
+class symbol
+{
+ public:
+ symbol (asymbol* sym);
+ symbol (asymbol* sym, std::string src_filename);
+
+ // Get the start address of this symbol
+ inline bfd_vma start (void) const { return bfd_asymbol_value (_asymbol); };
+
+ // Get the end address of this symbol
+ inline bfd_vma end (void) const { return _end; };
+
+ // Set the end address of this symbol
+ inline void end (bfd_vma addr) { _end = addr; };
+
+ // Get BFD's symbol info
+ inline asymbol* get_asymbol (void) const { return _asymbol; };
+
+ // Get BFD's section info
+ inline asection* section (void) const { return bfd_get_section (_asymbol); };
+
+ // Get the name of this symbol
+ inline const char* name (void) const { return bfd_asymbol_name (_asymbol); };
+
+ // Get the demangled name of this symbol (could be the same as name())
+ const char* demangled_name (void) const;
+
+ // Get the BFD flags for this symbol (i.e., BSF_FUNCTION, BSF_GLOBAL)
+ inline flagword flags (void) const { return _asymbol->flags; };
+
+ // Does this symbol contain the address ADDR?
+ bool contains (bfd_vma addr) const;
+
+ // return filename this symbol is in (used in operator<<)
+ inline const char * get_srcfilename() const { return _src_filename.c_str(); };
+
+ // Constant that all unset address are set to
+ static const bfd_vma UNSET;
+
+ //add the sample s to the list of samples under this symbol
+ inline void add_sample(sample* s) { _samples.insert(_samples.begin(), s); };
+
+ // return the samples (used in operator<< when outputting all the samples)
+ inline const std::set<sample*, sample_comp>* get_sample_list() const { return &_samples; };
+
+ // add the count of a sample to the total count (called after a sample is added with add_sample())
+ inline void add_count(unsigned int c) { _count += c; };
+
+ // return total count of all samples under this symbol
+ inline const unsigned int get_count() const { return _count; };
+
+ protected:
+ // The end address of this symbol (can only be set once all symbols read)
+ bfd_vma _end;
+
+ // The BFD symbol
+ asymbol* _asymbol;
+
+ //filename the symbols is in (set later, from sample debuginfo)
+ std::string _src_filename;
+
+ //list of samples under this symbol, sorted by count
+ // the samples a freed in profileimage.cc
+ //NOTE: because of the sample aggregation in profileimage.cc
+ // and since the comparer uses both count and line # to compare,
+ // all samples are guaranteed to be unique and ordered properly
+ std::set<sample*, sample_comp> _samples;
+
+ //count for all samples below this symbol
+ unsigned int _count;
+};
+
+// ostream inserter for this class
+std::ostream& operator<< (std::ostream& os, const symbol* s);
+#endif // !_SYMBOL_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.cc
new file mode 100644
index 0000000000..d880959e61
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.cc
@@ -0,0 +1,101 @@
+/* xmlbuf - A class for XML output on an ostream.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <stdio.h>
+
+#include "xmlbuf.h"
+#include "xmltag.h"
+
+#define XML_ENCODING "UTF-8"
+#define XML_VERSION "1.0"
+
+using namespace std;
+
+xmlbuf::xmlbuf (ostream& outstream)
+ : _os (outstream)
+{
+ _top = xmltag::dtd_header (XML_VERSION, XML_ENCODING);
+ _current = _top;
+ _tag_stack = new stack<xmltag*> ();
+}
+
+xmlbuf::~xmlbuf ()
+{
+ // delete tree
+ delete _top;
+
+ // delete tag stack and any items left on it
+ while (!_tag_stack->empty ())
+ {
+ xmltag* t = _tag_stack->top ();
+ _tag_stack->pop ();
+ delete t;
+ }
+
+ delete _tag_stack;
+}
+
+// Only tags get text -- escape reserved characters
+int
+xmlbuf::overflow (int ch)
+{
+ switch (ch)
+ {
+ case EOF:
+ /* nothing */ break;
+ case '&':
+ _current->add_text ("&amp;"); break;
+ case '<':
+ _current->add_text ("&lt;"); break;
+ case '>':
+ _current->add_text ("&gt;"); break;
+ case '\'':
+ _current->add_text ("&apos;"); break;
+ case '\"':
+ _current->add_text ("&quot;"); break;
+ default:
+ _current->add_char (ch); break;
+ }
+
+ return ch;
+}
+
+void
+xmlbuf::add_tag (const string& tag_name)
+{
+ xmltag* tag = _current->add_child (tag_name);
+ _tag_stack->push (_current);
+ _current = tag;
+}
+
+void
+xmlbuf::end_tag (void)
+{
+ _current = _tag_stack->top ();
+ _tag_stack->pop ();
+}
+
+void
+xmlbuf::add_attr (const string& name, const string& value)
+{
+ _current->add_attr (name, value);
+}
+
+void
+xmlbuf::dump (void)
+{
+ // dump output to stream
+ _top->output (_os);
+
+ // reset top of tree
+ _top->delete_children ();
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.h
new file mode 100644
index 0000000000..ee69f2d09f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlbuf.h
@@ -0,0 +1,62 @@
+/* xmlbuf - A class for XML output on an ostream.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _XMLBUF_H
+#define _XMLBUF_H
+#include <streambuf>
+#include <ostream>
+#include <string>
+#include <stack>
+
+class xmltag;
+
+class xmlbuf : public std::streambuf
+{
+ public:
+ // Constructor - pass in the ostream to which to dump the whole
+ // XML tree.
+ xmlbuf (std::ostream& outstream);
+ ~xmlbuf ();
+
+ // Adds an XML tag of the given name
+ // Invoked via "addt" operator (defined in xmlfmt.h)
+ void add_tag (const std::string& tag_name);
+
+ // Ends the current tag
+ // Invoked via "endt" operator (defined in xmlfmt.h)
+ void end_tag (void);
+
+ // Adds the given attribute NAME with VALUE to the current tag
+ // Invoked via "attrt" operator (defined in xmlfmt.h)
+ void add_attr (const std::string& name, const std::string& value);
+
+ // Dumps the whole tree to the (real) output stream
+ // Invoked via "endxml" operator (defined in xmlfmt.h)
+ void dump (void);
+
+ protected:
+ int overflow (int ch);
+
+ private:
+ // The ostream to dump the tree
+ std::ostream& _os;
+
+ // The top of the XML document tree
+ xmltag* _top;
+
+ // The current node in the tree being constructed
+ xmltag* _current;
+
+ // A stack of tags being constructed
+ std::stack<xmltag*>* _tag_stack;
+};
+#endif // !_XMLBUF_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.cc
new file mode 100644
index 0000000000..2e718a5790
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.cc
@@ -0,0 +1,79 @@
+/* xmlfmt - defines several operators and classes for formatting
+ an XML stream (see oxmlstream.h)
+ Written by Keith Seitz <keiths@redhat.com>
+ Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2003,2009 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "xmlfmt.h"
+#include "xmlbuf.h"
+
+using namespace std;
+
+ostream&
+operator<< (ostream& os, const startt& s)
+{
+ xmlbuf* xbuf = dynamic_cast<xmlbuf*> (os.rdbuf ());
+ if (xbuf != NULL)
+ xbuf->add_tag (s._name);
+ return os;
+}
+
+ostream&
+operator<< (ostream& os, const attrt& a)
+{
+ xmlbuf* xbuf = dynamic_cast<xmlbuf*> (os.rdbuf ());
+ if (xbuf != NULL) {
+ valid_string(const_cast<string&>(a._value));
+ xbuf->add_attr (a._name, a._value);
+ }
+ return os;
+}
+
+ostream&
+endt (ostream& os)
+{
+ xmlbuf* xbuf = dynamic_cast<xmlbuf*> (os.rdbuf ());
+ if (xbuf != NULL)
+ xbuf->end_tag ();
+ return os;
+}
+
+ostream&
+endxml (ostream& os)
+{
+ xmlbuf *xbuf = dynamic_cast<xmlbuf*> (os.rdbuf ());
+ if (xbuf != NULL)
+ xbuf->dump ();
+ return os;
+}
+
+//cant have characters "'&<> in an attribute, will cause xml parsing exceptions
+void
+valid_string (string &s) {
+ string chars = "&\"'<>";
+ string char_replacements[] = {"&amp;", "&quot;", "&apos;", "&lt;", "&gt;"};
+ char search_char;
+
+ for (int char_index = 0; char_index < 5; char_index++) {
+ search_char = chars[char_index];
+
+ string::size_type search_index = 0;
+ while(1) {
+ search_index = s.find(search_char, search_index);
+
+ if (search_index == string::npos)
+ break;
+
+ s.replace(search_index, 1, char_replacements[char_index]);
+ search_index += char_replacements[char_index].length();
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.h
new file mode 100644
index 0000000000..56345e0b14
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmlfmt.h
@@ -0,0 +1,52 @@
+/* xmlfmt - defines several operators and classes for formatting
+ an XML stream (see oxmlstream.h)
+ Written by Keith Seitz <keiths@redhat.com>
+ Kent Sebastian <ksebasti@redhat.com>
+ Copyright 2003,2009 Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#ifndef _XMLFMT_H
+#define _XMLFMT_H
+#include <ostream>
+
+// Start a new tag with the given NAME
+class startt
+{
+ public:
+ startt (const std::string &name) : _name (name) {};
+ friend std::ostream& operator<< (std::ostream& os, const startt& s);
+
+ private:
+ std::string _name;
+};
+
+// Add an attribute with the given NAME and VALUE to the current tag
+class attrt
+{
+ public:
+ attrt (const std::string& name, const std::string& value)
+ : _name (name), _value (value) {};
+ friend std::ostream& operator<< (std::ostream&, const attrt& a);
+
+ private:
+ std::string _name;
+ std::string _value;
+
+};
+
+// End the current tag
+std::ostream& endt (std::ostream& os);
+
+// End the XML document and output it
+std::ostream& endxml (std::ostream& os);
+
+//function to ensure strings dont have invalid characters
+void valid_string(std::string &s);
+#endif // ! _XMLFMT_H
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.cc b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.cc
new file mode 100644
index 0000000000..a2f25ab631
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.cc
@@ -0,0 +1,157 @@
+/* xmltag/xmlattr - Classes which are nodes in the XML document tree
+ constructed by oxmlstream, xmlbuf, xmlfmt.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include "xmltag.h"
+
+using namespace std;
+
+bool xmltag::_header_output = false;
+
+xmltag*
+xmltag::dtd_header (string version, string encoding)
+{
+ string txt ("<?xml version=\"" + version + "\" encoding=\"" + encoding + "\"?>");
+ xmltag* header = new xmltag ("");
+ header->add_text (txt);
+ return header;
+}
+
+xmltag::xmltag (const string& name)
+ : _name (name), _level (-1)
+{
+ _children = new _childlist_t;
+}
+
+xmltag::xmltag (const string& name, int level)
+ : _name (name), _level (level)
+{
+ _children = new _childlist_t;
+}
+
+xmltag::~xmltag ()
+{
+ // delete all children
+ delete_children ();
+ delete _children;
+}
+
+void
+xmltag::delete_children (void)
+{
+ _childlist_t::iterator i;
+ for (i = _children->begin (); i != _children->end (); ++i)
+ delete (*i);
+
+ _children->clear ();
+}
+
+xmltag*
+xmltag::add_child (const string& name)
+{
+ xmltag* child = new xmltag (name, _level + 1);
+ _children->push_back (child);
+ return child;
+}
+
+void
+xmltag::add_text (const string& txt)
+{
+ _text += txt;
+}
+
+void
+xmltag::add_char (const char c)
+{
+ _text += c;
+}
+
+void
+xmltag::add_attr (const string& name, const string& value)
+{
+ _attributes.add (name, value);
+}
+
+// Tags output a start tag with attributes, then children, then a closing tag.
+void
+xmltag::output (ostream& os)
+{
+ bool is_hdr = (_level == -1);
+ bool no_txt = (_text.length () == 0);
+
+ if (is_hdr)
+ {
+ if (!xmltag::_header_output)
+ {
+ os << _text << endl;
+ xmltag::_header_output = true;
+ }
+ }
+ else
+ {
+ os << _indent () << "<" << _name;
+ _attributes.output (os);
+ os << ">" << _text;
+ if (no_txt)
+ os << endl;
+ }
+
+ // output children
+ _output_children (os);
+
+ if (!is_hdr)
+ {
+ if (no_txt)
+ os << _indent ();
+ os << "</" << _name << ">" << endl;
+ }
+}
+
+// Walk through children, having them output themselves
+void
+xmltag::_output_children (ostream& os)
+{
+ _childlist_t::iterator i;
+ for (i = _children->begin (); i != _children->end (); ++i)
+ {
+ xmltag* child = (*i);
+ child->output (os);
+ }
+}
+
+string
+xmltag::_indent (void)
+{
+ return (_level > 0 ? std::string (_level, '\t') : "");
+}
+
+xmlattr::~xmlattr ()
+{
+ list<attr_t*>::iterator i;
+ for (i = _attributes.begin (); i != _attributes.end (); ++i)
+ delete (*i);
+}
+
+void
+xmlattr::add (const string& name, const string& value)
+{
+ _attributes.push_back (new attr_t (name, value));
+}
+
+// Attributes output 'name="value"' for each attribute
+void
+xmlattr::output (ostream& os)
+{
+ list<attr_t*>::iterator i;
+ for (i = _attributes.begin (); i != _attributes.end (); ++i)
+ os << " " << attr_name (*i) << "=\"" << attr_value (*i) << "\"";
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.h b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.h
new file mode 100644
index 0000000000..dd556ce7d6
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/opxml/xmltag.h
@@ -0,0 +1,101 @@
+/* xmltag/xmlattr - Classes which are nodes in the XML document tree
+ constructed by oxmlstream, xmlbuf, xmlfmt.
+ Written by Keith Seitz <keiths@redhat.com>
+ Copyright 2003, Red Hat, Inc.
+
+ This program is open source software licensed under the Eclipse
+ Public License ver. 1.
+
+ Alternatively, this program may be used under the terms of the GNU
+ General Public License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any later
+ version. */
+
+#include <utility>
+#include <string>
+#include <list>
+#include <ostream>
+
+// An XML tag attribute handler class
+class xmlattr
+{
+ public:
+ ~xmlattr();
+
+ // The type of all attributes
+ typedef std::pair<std::string, std::string> attr_t;
+
+ // Convenience accessors
+ static inline const std::string& attr_name (const attr_t* a) { return a->first; };
+ static inline const std::string& attr_value (const attr_t* a) { return a->second; };
+
+ // Add an attribute of the given NAME and VALUE
+ void add (const std::string& name, const std::string& value);
+
+ // Output all attributes to the given ostream.
+ void output (std::ostream& os);
+
+ private:
+ // A list of all attributes
+ std::list<attr_t*> _attributes;
+};
+
+// An XML tag
+class xmltag
+{
+ public:
+ // Convenience function to construct a "tag" which contains
+ // document type definition
+ static xmltag* dtd_header (std::string version, std::string encoding);
+
+ // Constructors - give NAME of tag and (optionally) an indent level
+ xmltag (const std::string& name);
+ xmltag (const std::string& name, int level);
+ ~xmltag ();
+
+ // Add a under this tag of the given NAME and return a pointer to it
+ xmltag* add_child (const std::string& name);
+
+ // Delete all children
+ void delete_children (void);
+
+ // Add an attribute of the given NAME and VALUE to this tag
+ void add_attr (const std::string& name, const std::string& value);
+
+ // Add the character C to the text contained in this tag
+ void add_char (const char c);
+
+ // Add the given TXT to the text contained in this tag
+ void add_text (const std::string& txt);
+
+ // Output the tag and it's text to the given stream
+ void output (std::ostream& os);
+
+ private:
+ // convenience type of the list of child tags
+ typedef std::list<xmltag*> _childlist_t;
+
+ // A function to return indentation
+ std::string _indent (void);
+
+ // Convenience function to output the children of this tag to the given stream
+ void _output_children (std::ostream& os);
+
+ // Have we output the DTD?
+ static bool _header_output;
+
+ // The name of this tag
+ std::string _name;
+
+ // The text of this tag
+ std::string _text;
+
+ // The attributes associated with this tag
+ xmlattr _attributes;
+
+ // The "children" of this tag (i.e., tags this tag encloses)
+ _childlist_t* _children;
+
+ // The indent level for this tag
+ int _level;
+};
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/.svnignore
new file mode 100644
index 0000000000..3808cac180
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/.svnignore
@@ -0,0 +1,2 @@
+opcontrol
+opcontrol.old
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install-noconsolehelper.sh b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install-noconsolehelper.sh
new file mode 100755
index 0000000000..27fdc88b53
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install-noconsolehelper.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# This script installs the files necessary for root authentication when using
+# Eclipse-OProfile.
+#
+
+### check install requirements ###
+
+#needs to be run as root
+if [ `id -u` -ne 0 ]; then
+ echo Error: script must be run as the root user
+ exit 1
+fi
+
+#need to be in scripts dir
+if [ $(basename $(pwd)) != scripts ]; then
+ echo Error: script must be run with pwd in script dir
+ exit 1
+fi
+
+#need oprofile package to use plugin at all
+RET=0
+test -x /usr/bin/oprofiled
+RET=$(($RET + $?))
+test -x /usr/bin/opcontrol
+RET=$(($RET + $?))
+if [ $RET -ne 0 ]; then
+ echo Error: required binaries do not exist, OProfile not installed?
+ exit 1
+fi
+
+#check for opxml executable, make sure it is u+x
+ALLOPXML=`find ../../../../org.eclipse.linuxtools.oprofile.core.linux.* -name opxml -type f | wc -l`
+EXECOPXML=`find ../../../../org.eclipse.linuxtools.oprofile.core.linux.* -name opxml -type f -perm -u+x | wc -l`
+if [ $ALLOPXML -eq 0 ]; then
+ echo Error: cannot find opxml binary, required plugin missing
+ exit 1
+elif [ $EXECOPXML -ne $ALLOPXML ]; then
+ #they exist, but aren't executable, run chmod u+x on them
+ find ../../../.. -name opxml -type f -exec chmod u+x '{}' \;
+fi
+
+echo Copy the following line for the sudoers file, replacing "<username>" with your username:
+echo "<username> ALL=(ALL) NOPASSWD : /usr/bin/opcontrol"
+read -p 'Running visudo, paste the above line in the editor, save it and exit. Press ENTER to continue.'
+visudo
+
+#create opcontrol sudo wrapper
+echo '#!/bin/sh' > opcontrol
+echo 'sudo /usr/bin/opcontrol ${1+"$@"}' >> opcontrol
+chmod +x ./opcontrol
+
+echo Eclipse-OProfile plugin install successful.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install.sh b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install.sh
new file mode 100755
index 0000000000..80c5475fd9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/install.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+#
+# This script installs the files necessary for root authentication when using
+# Eclipse-OProfile.
+#
+
+### check install requirements ###
+
+#needs to be run as root
+if [ `id -u` -ne 0 ]; then
+ echo Error: script must be run as the root user
+ exit 1
+fi
+
+#need to be in scripts dir
+if [ $(basename $(pwd)) != scripts ]; then
+ echo Error: script must be run with pwd in script dir
+ exit 1
+fi
+
+#need oprofile package to use plugin at all
+RET=0
+test -x /usr/bin/oprofiled
+RET=$(($RET + $?))
+test -x /usr/bin/opcontrol
+RET=$(($RET + $?))
+if [ $RET -ne 0 ]; then
+ echo Error: required binaries do not exist, OProfile not installed?
+ exit 1
+fi
+
+#need consolehelper to run opcontrol as root from within eclipse
+test -x /usr/bin/consolehelper
+if [ $? -ne 0 ]; then
+ echo Error: /usr/bin/consolehelper does not exist, run install-noconsolehelper.sh instead
+ exit 1
+fi
+
+
+### install ###
+
+#create the sym link to consolehelper
+test -L ./opcontrol || { rm -f ./opcontrol && ln -s /usr/bin/consolehelper opcontrol ; }
+if [ $? -ne 0 ]; then
+ echo Error: cannot create opcontrol wrapper in `pwd`
+ exit 1
+fi
+
+#check for opxml executable, make sure it is u+x
+ALLOPXML=`find ../../../../org.eclipse.linuxtools.oprofile.core.linux.* -name opxml -type f | wc -l`
+EXECOPXML=`find ../../../../org.eclipse.linuxtools.oprofile.core.linux.* -name opxml -type f -perm -u+x | wc -l`
+if [ $ALLOPXML -eq 0 ]; then
+ echo Error: cannot find opxml binary, required plugin missing
+ exit 1
+elif [ $EXECOPXML -ne $ALLOPXML ]; then
+ #they exist, but aren't executable, run chmod u+x on them
+ find ../../../.. -name opxml -type f -exec chmod u+x '{}' \;
+fi
+
+##this will have to be loaded every time the user restarts their
+##computer anyway, should load it now?
+#load the oprofile module
+#test /dev/oprofile/cpu_type
+#if [ $? -ne 0 ]; then
+# opcontrol --init
+#fi
+
+test -f /etc/security/console.apps/opcontrol || install -D -m 644 opcontrol-wrapper.security /etc/security/console.apps/opcontrol
+test -f /etc/pam.d/opcontrol || install -D -m 644 opcontrol-wrapper.pamd /etc/pam.d/opcontrol
+
+echo Eclipse-OProfile plugin install successful.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.pamd b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.pamd
new file mode 100644
index 0000000000..14badf9f14
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.pamd
@@ -0,0 +1,9 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+auth sufficient pam_timestamp.so
+auth include system-auth
+account required pam_permit.so
+session required pam_permit.so
+session optional pam_xauth.so
+session optional pam_timestamp.so
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.security b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.security
new file mode 100644
index 0000000000..b147801628
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/opcontrol-wrapper.security
@@ -0,0 +1,3 @@
+USER=root
+PROGRAM=/usr/bin/opcontrol
+SESSION=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall-noconsolehelper.sh b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall-noconsolehelper.sh
new file mode 100755
index 0000000000..5bc9d7f654
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall-noconsolehelper.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# This script uninstalls the files necessary for root authentication when using
+# Eclipse-OProfile.
+
+#needs to be run as root
+if [ `id -u` -ne 0 ]; then
+ echo Error: script must be run as the root user
+ exit 1
+fi
+
+#need to be in scripts dir
+if [ $(basename $(pwd)) != scripts ]; then
+ echo Error: script must be run with pwd in script dir
+ exit 1
+fi
+
+rm -f ./opcontrol
+
+read -p 'Running visudo; remove the line: <username> ALL=NOPASSWD : /usr/bin/opcontrol'
+visudo
+
+echo Eclipse-OProfile plugin uninstall successful.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall.sh b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall.sh
new file mode 100755
index 0000000000..62368aaeeb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/natives/linux/scripts/uninstall.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# This script uninstalls the files necessary for root authentication when using
+# Eclipse-OProfile.
+
+#needs to be run as root
+if [ `id -u` -ne 0 ]; then
+ echo Error: script must be run as the root user
+ exit 1
+fi
+
+#need to be in scripts dir
+if [ $(basename $(pwd)) != scripts ]; then
+ echo Error: script must be run with pwd in script dir
+ exit 1
+fi
+
+rm -f /etc/security/console.apps/opcontrol
+rm -f /etc/pam.d/opcontrol
+rm -f ./opcontrol
+
+echo Eclipse-OProfile plugin uninstall successful.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.properties
new file mode 100644
index 0000000000..f647694b4b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Core Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.xml b/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.xml
new file mode 100644
index 0000000000..6e34065454
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/plugin.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="OpxmlProvider" name="OpxmlProvider" schema="schema/OpxmlProvider.exsd"/>
+
+</plugin>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/schema/OpxmlProvider.exsd b/oprofile/org.eclipse.linuxtools.oprofile.core/schema/OpxmlProvider.exsd
new file mode 100644
index 0000000000..8b02e63529
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/schema/OpxmlProvider.exsd
@@ -0,0 +1,70 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.linuxtools.oprofile.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.linuxtools.oprofile.core" id="OpxmlProvider" name="OpxmlProvider"/>
+ </appinfo>
+ <documentation>
+ An extension point to allow architecture fragments to provide the opxml binary.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="opxmlProvider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="opxmlProvider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.linuxtools.oprofile.core.IOpxmlProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+
+
+
+
+</schema>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpcontrolProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpcontrolProvider.java
new file mode 100644
index 0000000000..d381b39ec7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpcontrolProvider.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core;
+
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+
+/**
+ * Interface for oprofile core to utilize opcontrol program. Platform plugins should define/register
+ * an OpcontrolProvider for the core to use.
+ */
+public interface IOpcontrolProvider {
+
+ /**
+ * Initialize the Oprofile kernel module
+ * @throws OpcontrolException
+ */
+ public void initModule() throws OpcontrolException;
+
+ /**
+ * De-initialize (unload) the kernel module
+ * @throws OpcontrolException
+ */
+ public void deinitModule() throws OpcontrolException;
+
+ /**
+ * Clears out data from the current session
+ * @throws OpcontrolException
+ */
+ public void reset() throws OpcontrolException;
+
+ /**
+ * Flush the current oprofiled sample buffers to disk
+ * @throws OpcontrolException
+ */
+ public void dumpSamples() throws OpcontrolException;
+
+ /**
+ * Setup oprofiled collection parameters
+ * @param options a list of command-line arguments for opcontrol
+ * @param events list of events to collect
+ * @throws OpcontrolException
+ */
+ public void setupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) throws OpcontrolException;
+
+ /**
+ * Start data collection by oprofiled (will start oprofiled if necessary)
+ * @throws OpcontrolException
+ */
+ public void startCollection() throws OpcontrolException;
+
+ /**
+ * Stop data collection (does NOT stop daemon)
+ * @throws OpcontrolException
+ */
+ public void stopCollection() throws OpcontrolException;
+
+ /**
+ * Stop data collection and shutdown oprofiled
+ * @throws OpcontrolException
+ */
+ public void shutdownDaemon() throws OpcontrolException;
+
+ /**
+ * Start oprofiled (does NOT start data collection)
+ * @throws OpcontrolException
+ */
+ public void startDaemon() throws OpcontrolException;
+
+ /**
+ * Save the current session
+ * @throws OpcontrolException
+ */
+ public void saveSession(String name) throws OpcontrolException;
+
+ public boolean status() throws OpcontrolException;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpxmlProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpxmlProvider.java
new file mode 100644
index 0000000000..b7512e9a75
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/IOpxmlProvider.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+
+/**
+ * Interface for the core to utilize opxml. Platform plugins should define/register an
+ * OpxmlProvider for the core to use.
+ */
+public interface IOpxmlProvider {
+
+ /**
+ * Returns an <code>IRunnableWithProgress</code> that fetches generic information from opxml
+ * @param info <code>OpInfo</code> object for results
+ * @return <code>IRunnableWithProgress</code> that may be run by the caller
+ */
+ public IRunnableWithProgress info(OpInfo info);
+
+ /**
+ * Returns an <code>IRunnableWithProgress</code> that fetches samples for the
+ * given <code>OpModelSession</code>
+ * @param eventName the event for which to fetch samples
+ * @param sessionName the session for which to fetch samples
+ * @param image the image being profiled to be returned to the caller
+ * @return <code>IRunnableWithProgress</code> that may be run by the caller
+ */
+ public IRunnableWithProgress modelData(String eventName, String sessionName, OpModelImage image);
+
+ /**
+ * Returns an <code>IRunnableWithProgress</code> that checks the validity of the given
+ * event, unit mask, and counter combination
+ * @param ctr the counter
+ * @param event the integer event number
+ * @param um the integer unit mask
+ * @param eventValid a size one array to hold the return result (see <code>CheckEventsProcessor</code>)
+ * @return <code>IRunnableWithProgress</code> that may be run by the caller
+ */
+ public IRunnableWithProgress checkEvents(int ctr, int event, int um, int[] eventValid);
+
+ /**
+ * Returns an /code>IRunnableWithProgress</code> that fetches the list of sessions
+ * @param info the <code>OpInfo</code> for oprofile
+ * @param sessionList an <code>ArrayList</code> in which to return the list of sessions
+ * @return <code>IRunnableWithProgress</code> that may be run by the caller
+ */
+ public IRunnableWithProgress sessions(ArrayList<OpModelEvent> sessionList);
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpcontrolException.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpcontrolException.java
new file mode 100644
index 0000000000..f6de34bd7b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpcontrolException.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+
+public class OpcontrolException extends CoreException {
+ //without this there's a warning..
+ private static final long serialVersionUID = 8508930482724912901L;
+
+ public OpcontrolException(IStatus status) {
+ super(status);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java
new file mode 100644
index 0000000000..7e0f5f485b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/Oprofile.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.opxml.checkevent.CheckEventsProcessor;
+
+
+/**
+ * Common class wrapper for all things Oprofile.
+ */
+public class Oprofile
+{
+ // Ugh. Need to know whether the module is loaded without running oprofile commands...
+ private static final String[] _OPROFILE_CPU_TYPE_FILES = {
+ "/dev/oprofile/cpu_type", //$NON-NLS-1$
+ "/proc/sys/dev/oprofile/cpu_type" //$NON-NLS-1$
+ };
+
+ // Oprofile information
+ private static OpInfo _info;
+
+ // Make sure that oprofile is ready to go
+ static {
+ initializeOprofileModule();
+ }
+
+ /**
+ * Initialize the oprofile module
+ *
+ * This function will check if the kernel module is
+ * loaded. If it is not, it will attempt to load it
+ * (which will cause the system to prompt the user for
+ * root access).
+ */
+ static private void initializeOprofileModule() {
+ // Check if kernel module is loaded, if not, try to load it
+ if (!isKernelModuleLoaded())
+ _initializeOprofile();
+
+ //it still may not have loaded, if not, critical error
+ if (!isKernelModuleLoaded()) {
+ OprofileCorePlugin.showErrorDialog("oprofileInit", null); //$NON-NLS-1$
+ throw new ExceptionInInitializerError(OprofileProperties.getString("fatal.kernelModuleNotLoaded")); //$NON-NLS-1$
+ } else {
+ _initializeOprofileCore();
+ }
+ }
+
+ // This requires more inside knowledge about Oprofile than one would like,
+ // but it is the only way of knowing whether the module is loaded (and we can
+ // succesfully call into the oprofile wrapper library without causing it to print out
+ // a lot of warnings).
+ private static boolean isKernelModuleLoaded() {
+ for (int i = 0; i < _OPROFILE_CPU_TYPE_FILES.length; ++i) {
+ File f = new File(_OPROFILE_CPU_TYPE_FILES[i]);
+ if (f.exists())
+ return true;
+ }
+
+ return false;
+ }
+
+ // initialize oprofile module by calling `opcontrol --init`
+ private static void _initializeOprofile() {
+ try {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().initModule();
+ } catch (OpcontrolException e) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", e); //$NON-NLS-1$
+ }
+ }
+
+
+ // Initializes static data for oprofile.
+ private static void _initializeOprofileCore () {
+ _info = OpInfo.getInfo();
+
+ if (_info == null) {
+ throw new ExceptionInInitializerError(OprofileProperties.getString("fatal.opinfoNotParsed")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Queries oprofile for the number of counters on the current CPU.
+ * Used only in launch config tabs.
+ * @return the number of counters
+ */
+ public static int getNumberOfCounters() {
+ return _info.getNrCounters();
+ }
+
+ /**
+ * Returns the CPU speed of the current configuration.
+ * @return the cpu speed in MHz
+ */
+ public static double getCpuFrequency() {
+ return _info.getCPUSpeed();
+ }
+
+ /**
+ * Finds the event with the given name
+ * @param name the event's name (i.e., CPU_CLK_UNHALTED)
+ * @return the event or <code>null</code> if not found
+ */
+ public static OpEvent findEvent(String name) {
+ return _info.findEvent(name);
+ }
+
+ /**
+ * Get all the events that may be collected on the given counter.
+ * @param num the counter number
+ * @return an array of all valid events -- NEVER RETURNS NULL!
+ */
+ public static OpEvent[] getEvents(int num) {
+ return _info.getEvents(num);
+ }
+
+ /**
+ * Returns the default location of the oprofile samples directory.
+ * @return the default samples directory
+ */
+ public static String getDefaultSamplesDirectory() {
+ return _info.getDefault(OpInfo.DEFAULT_SAMPLE_DIR);
+ }
+
+ /**
+ * Returns the oprofile daemon log file.
+ * @return the log file (absolute pathname)
+ */
+ public static String getLogFile() {
+ return _info.getDefault(OpInfo.DEFAULT_LOG_FILE);
+ }
+
+ /**
+ * Returns whether or not oprofile is in timer mode.
+ * @return true if oprofile is in timer mode, false otherwise
+ */
+ public static boolean getTimerMode() {
+ return _info.getTimerMode();
+ }
+
+ /**
+ * Checks the requested counter, event, and unit mask for vailidity.
+ * @param ctr the counter
+ * @param event the event number
+ * @param um the unit mask
+ * @return whether the requested event is valid
+ */
+ public static Boolean checkEvent(int ctr, int event, int um) {
+ int[] validResult = new int[1];
+ try {
+ IRunnableWithProgress opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().checkEvents(ctr, event, um, validResult);
+ opxml.run(null);
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
+ } catch (OpxmlException e) {
+ OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$
+ return null;
+ }
+
+ return (validResult[0] == CheckEventsProcessor.EVENT_OK);
+ }
+
+ /**
+ * Returns a list of all the events collected on the system, as well as
+ * the sessions under each of them.
+ * @returns a list of all collected events
+ */
+ public static OpModelEvent[] getEvents() {
+ OpModelEvent[] events = null;
+
+ ArrayList<OpModelEvent> sessionList = new ArrayList<OpModelEvent>();
+ try {
+ IRunnableWithProgress opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().sessions(sessionList);
+ opxml.run(null);
+ events = new OpModelEvent[sessionList.size()];
+ sessionList.toArray(events);
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
+ } catch (OpxmlException e) {
+ OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$
+ }
+ return events;
+ }
+
+ /**
+ * Return a list of all the Samples in the given session.
+ * @param session the session for which to get samples
+ * @param shell the composite shell to use for the progress dialog
+ */
+ public static OpModelImage getModelData(String eventName, String sessionName) {
+ OpModelImage image = new OpModelImage();
+
+ final IRunnableWithProgress opxml;
+ try {
+ opxml = OprofileCorePlugin.getDefault().getOpxmlProvider().modelData(eventName, sessionName, image);
+ opxml.run(null);
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
+ } catch (OpxmlException e) {
+ OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$
+ return null;
+ }
+
+ return image;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileCorePlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileCorePlugin.java
new file mode 100644
index 0000000000..c36fa408ca
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileCorePlugin.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.linuxtools.oprofile.core.linux.LinuxOpcontrolProvider;
+import org.eclipse.swt.widgets.Display;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class OprofileCorePlugin extends Plugin {
+ private static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.core"; //$NON-NLS-1$
+ private static final String OPXMLPROVIDER_XPT_NAME = "OpxmlProvider"; //$NON-NLS-1$
+
+ //The shared instance.
+ private static OprofileCorePlugin plugin;
+ private IOpxmlProvider _opxmlProvider;
+
+ /**
+ * The constructor.
+ */
+ public OprofileCorePlugin() {
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static OprofileCorePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the unique id of this plugin. Should match plugin.xml!
+ */
+ public static String getId() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Returns the OpxmlProvider registered with the plugin or throws an exception
+ * @return the OpxmlProvider
+ * @throws OpxmlException
+ */
+ public IOpxmlProvider getOpxmlProvider() throws OpxmlException {
+ Exception except = null;
+
+ if (_opxmlProvider == null) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extension = registry.getExtensionPoint(PLUGIN_ID, OPXMLPROVIDER_XPT_NAME);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for (IExtension e : extensions) {
+ IConfigurationElement[] configElements = e.getConfigurationElements();
+ if (configElements.length != 0) {
+ try {
+ _opxmlProvider = (IOpxmlProvider) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
+ if (_opxmlProvider != null)
+ break;
+ } catch (CoreException ce) {
+ except = ce;
+ }
+ }
+ }
+ }
+ }
+
+ // If there was a problem finding opxml, throw an exception
+ if (_opxmlProvider == null) {
+ throw new OpxmlException(createErrorStatus("opxmlProvider", except)); //$NON-NLS-1$
+ } else {
+ return _opxmlProvider;
+ }
+ }
+
+ /**
+ * Returns the registered opcontrol provider or throws an exception
+ * @return the OpcontrolProvider registered with the plugin
+ * @throws OpcontrolException
+ */
+ public IOpcontrolProvider getOpcontrolProvider() throws OpcontrolException {
+// Exception except = null;
+//
+// if (_opcontrol == null) {
+// IExtensionRegistry registry = Platform.getExtensionRegistry();
+// IExtensionPoint extension = registry.getExtensionPoint(PLUGIN_ID, "OpcontrolProvider"); //$NON-NLS-1$
+// if (extension != null) {
+// IExtension[] extensions = extension.getExtensions();
+// IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
+// if (configElements.length != 0) {
+// try {
+// _opcontrol = (IOpcontrolProvider) configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
+// } catch (CoreException ce) {
+// except = ce;
+// }
+// }
+// }
+// }
+//
+// // If there was a problem finding opcontrol, throw an exception
+// if (_opcontrol == null) {
+// String msg = getResourceString("opcontrolProvider.error.missing"); //$NON-NLS-1$
+// Status status = new Status(IStatus.ERROR, getId(), IStatus.OK, msg, except);
+// throw new OpcontrolException(status);
+// }
+//
+// return _opcontrol;
+
+ return new LinuxOpcontrolProvider();
+ }
+
+ public static IStatus createErrorStatus(String errorClassString, Exception e) {
+ String statusMessage = OprofileProperties.getString(errorClassString + ".error.statusMessage"); //$NON-NLS-1$
+
+ if (e == null) {
+ return new Status(IStatus.ERROR, getId(), IStatus.OK, statusMessage, null);
+ } else {
+ return new Status(IStatus.ERROR, getId(), IStatus.OK, statusMessage, e);
+ }
+ }
+
+ public static void showErrorDialog(String errorClassString, CoreException ex) {
+ final IStatus status;
+ final String dialogTitle = OprofileProperties.getString(errorClassString + ".error.dialog.title"); //$NON-NLS-1$
+ final String errorMessage = OprofileProperties.getString(errorClassString + ".error.dialog.message"); //$NON-NLS-1$
+
+ if (ex == null) {
+ status = createErrorStatus(errorClassString, null);
+ } else {
+ status = ex.getStatus();
+ }
+
+ //needs to be run in the ui thread otherwise swt throws invalid thread access
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ ErrorDialog.openError(null, dialogTitle, errorMessage, status);
+ }
+ });
+
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileProperties.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileProperties.java
new file mode 100644
index 0000000000..f1bf26edde
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OprofileProperties.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class OprofileProperties {
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.oprofile.core.oprofile"; //$NON-NLS-1$
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private OprofileProperties() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpxmlException.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpxmlException.java
new file mode 100644
index 0000000000..21b40e0b53
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/OpxmlException.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * An exception thrown by any of the IOpxmlProvider functions
+ */
+public class OpxmlException extends CoreException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2788304536155025911L;
+
+ /**
+ * Constructor
+ * @param status <code>IStatus</code> for the exception
+ */
+ public OpxmlException(IStatus status) {
+ super(status);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpEvent.java
new file mode 100644
index 0000000000..9204f02e28
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpEvent.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.daemon;
+
+/**
+ * A class which represents an Oprofile event
+ */
+public class OpEvent {
+ // The Oprofile event name, i.e., "CPU_CLK_UNHALTED"
+ private String _name;
+
+ // The Oprofile event number
+ private int _number;
+
+ // A description of the event
+ private String _description;
+
+ // Unit masks for this event type
+ private OpUnitMask _unitMask;
+
+ // Minimum count
+ private int _minCount;
+
+ /**
+ * Sets the unit mask for this event.
+ * Only called from XML parsers.
+ * @param mask the new unit mask
+ */
+ public void _setUnitMask(OpUnitMask mask) {
+ _unitMask = mask;
+ }
+
+ /**
+ * Sets the name of this event.
+ * Only called from XML parsers.
+ * @param text the name
+ */
+ public void _setText(String text) {
+ _name = text;
+ }
+
+ /**
+ * Sets the description of this oprofile event.
+ * Only called from XML parsers.
+ * @param text the description
+ */
+ public void _setTextDescription(String text) {
+ _description = text;
+ }
+
+ /**
+ * Sets the minimum count for this event.
+ * Only called from XML parsers.
+ * @param min the minimum count
+ */
+ public void _setMinCount(int min) {
+ _minCount = min;
+ }
+
+ /**
+ * Sets oprofile's event number for this event.
+ * Only called from XML parsers.
+ * @param num the number
+ */
+ public void _setNumber(int num) {
+ _number = num;
+ }
+
+ /**
+ * Returns the unit mask corresponding to this event.
+ * @return the unit mask
+ */
+ public OpUnitMask getUnitMask() {
+ return _unitMask;
+ }
+
+ /**
+ * Returns the name of this oprofile event.
+ * @return the name
+ */
+ public String getText() {
+ return _name;
+ }
+
+ /**
+ * Returns the description of this oprofile event.
+ * @return the description
+ */
+ public String getTextDescription() {
+ return _description;
+ }
+
+ /**
+ * Returns the minimum count allowed for this event.
+ * @return the minimum count
+ */
+ public int getMinCount() {
+ return _minCount;
+ }
+
+ /**
+ * Returns oprofile's event number for this event.
+ * @return the event number
+ */
+ public int getNumber() {
+ return _number;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java
new file mode 100644
index 0000000000..573643ecfd
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpInfo.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.daemon;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.linux.LinuxOpxmlProvider.OpInfoRunner;
+import org.eclipse.linuxtools.oprofile.core.opxml.info.DefaultsProcessor;
+
+
+/**
+ * A class to hold generic information about Oprofile.
+ */
+public class OpInfo {
+ // Oprofile defaults
+ public static final String DEFAULT_SAMPLE_DIR = DefaultsProcessor.SAMPLE_DIR;
+ public static final String DEFAULT_LOCK_FILE = DefaultsProcessor.LOCK_FILE;
+ public static final String DEFAULT_LOG_FILE = DefaultsProcessor.LOG_FILE;
+ public static final String DEFAULT_DUMP_STATUS = DefaultsProcessor.DUMP_STATUS;
+
+ // A comparator class used when sorting events
+ // (sorting by event name)
+ private static class SortEventComparator implements Comparator<OpEvent> {
+ public int compare(OpEvent o1, OpEvent o2) {
+ return o1.getText().compareTo(o2.getText());
+ }
+ }
+
+ // A comparator class used when searching events
+ // (searching by event name)
+ private static class SearchEventComparator implements Comparator<Object> {
+ public int compare(Object a, Object b) {
+ String astr, bstr;
+ if (a instanceof String) {
+ astr = (String) a;
+ bstr = ((OpEvent) b).getText();
+ } else {
+ astr = ((OpEvent) a).getText();
+ bstr = (String) b;
+ }
+ return astr.compareTo(bstr);
+ }
+ }
+
+ // The number of counters supported by this configuration
+ private int _nrCounters;
+
+ // A HashMap of Oprofile defaults
+ private HashMap<String,String> _defaults;
+
+ // The permanent list of events indexed by counter
+ private OpEvent[][] _eventList;
+
+ // The CPU frequency of this CPU in MHz
+ private double _cpuSpeed;
+
+ // Whether or not oprofile is running in timer mode
+ private boolean _timerMode;
+
+ /**
+ * Return all of Oprofile's generic information.
+ * @return a class containing the information
+ */
+ public static OpInfo getInfo() {
+ // Run opmxl and get the static information
+ OpInfo info = new OpInfo();
+
+ try {
+ OpInfoRunner opxml = (OpInfoRunner) OprofileCorePlugin.getDefault().getOpxmlProvider().info(info);
+ boolean ret = opxml.run0(null);
+ if (ret == false)
+ info = null;
+ } catch (InvocationTargetException e) {
+ } catch (InterruptedException e) {
+ } catch (OpxmlException e) {
+ OprofileCorePlugin.showErrorDialog("opxmlProvider", e); //$NON-NLS-1$
+ }
+
+ return info;
+ }
+
+ /**
+ * Sets the number of counters allowed by Oprofile. This method is called
+ * after this object is contstructed, while opxml is run (the first tag output
+ * is num-counters).
+ * Only called from XML parsers.
+ * @param ctrs the number of counters
+ */
+ public void _setNrCounters(int ctrs) {
+ _nrCounters = ctrs;
+
+ // Allocate room for event lists for the counters
+ _eventList = new OpEvent[_nrCounters][];
+ }
+
+ /**
+ * Set the CPU frequency (in MHz).
+ * Only called from the XML parsers.
+ * @param freq the frequency
+ */
+ public void _setCPUSpeed(double freq) {
+ _cpuSpeed = freq;
+ }
+
+ /**
+ * Sets the defaults associated with this configuration of Oprofile.
+ * Only called from XML parsers.
+ * @param map the <code>HashMap</code> containing the defaults
+ */
+ public void _setDefaults(HashMap<String,String> map) {
+ _defaults = map;
+ }
+
+ /**
+ * Adds the events of the counter counterNum into the list of all events.
+ * Note they are sorted here.
+ * Only called from XML parsers.
+ * @param counterNum the counter with the events
+ * @param events an array of OpEvent events belonging to this counter
+ */
+ public void _setEvents(int counterNum, OpEvent[] events) {
+ if (counterNum < _eventList.length) {
+ _eventList[counterNum] = events;
+ Arrays.sort(_eventList[counterNum], new SortEventComparator());
+ }
+ }
+
+ /**
+ * Sets whether or not oprofile is operating in timer mode.
+ * Only called from XML parsers.
+ * @param timerMode true if oprofile is in timer mode, false if not
+ */
+ public void _setTimerMode(boolean timerMode) {
+ _timerMode = timerMode;
+ }
+
+ /**
+ * Returns the number of counters allowed by Oprofile
+ * @return the number of counters
+ */
+ public int getNrCounters() {
+ return _nrCounters;
+ }
+
+ /**
+ * Returns the CPU's speed in MHz
+ * @return the speed
+ */
+ public double getCPUSpeed() {
+ return _cpuSpeed;
+ }
+
+ /**
+ * Returns the requested default. Valid defaults are <code>DEFAULT_DUMP_STATUS</code>,
+ * <code>DEFAULT_LOCK_FILE</code>, <code>DEFAULT_LOG_FILE</code>, and
+ * <code>DEFAULT_SAMPLE_DIR</code>.
+ * @param what which default to return
+ * @return the requested default or <code>null</code> if not known
+ */
+ public String getDefault(String what) {
+ return (String) _defaults.get(what);
+ }
+
+ /**
+ * Returns an array of events valid for the given counter number.
+ * @param num the counter number
+ * @return an array of valid events
+ */
+ public OpEvent[] getEvents(int num) {
+ if (num >= 0 && num < _eventList.length)
+ return _eventList[num];
+
+ return new OpEvent[0];
+ }
+
+ /**
+ * Returns whether or not oprofile is operating in timer mode.
+ * @return a boolean, true if in timer mode, false if not
+ */
+ public boolean getTimerMode() {
+ return _timerMode;
+ }
+
+ /**
+ * Searches the for the event with the given name
+ * @param name the name of the event (e.g., CPU_CLK_UNHALTED)
+ * @return the event or <code>null</code> if not found
+ */
+ public OpEvent findEvent(String name) {
+ // Search through all counters
+ for (int counter = 0; counter < getNrCounters(); ++counter) {
+ int idx = Arrays.binarySearch(getEvents(counter), name, new SearchEventComparator());
+ if (idx >= 0)
+ return _eventList[counter][idx];
+ }
+
+ return null;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpUnitMask.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpUnitMask.java
new file mode 100644
index 0000000000..050cf0f5c5
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OpUnitMask.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.daemon;
+
+/**
+ * A class representing the unit mask that may be associated with oprofile
+ * events. Note that since this class was originally written, oprofile unit
+ * masks have changed -- a single unit mask may affect several bits at once.
+ * Hence, instead of a certain bit being flipped, the specific bits to be changed
+ * are determined by the particular mask's index
+ */
+public class OpUnitMask {
+ /**
+ * A class which describes an individual unit mask value. Used in XML parsing.
+ */
+ public static class MaskInfo {
+ /**
+ * The integer value of the mask.
+ */
+ public int value;
+
+ /**
+ * A description of the mask.
+ */
+ public String description;
+ };
+
+ public static final int SET_DEFAULT_MASK = -1;
+
+ /**
+ * Invalid mask type.
+ */
+ public static final int INVALID = -1;
+
+ /**
+ * The mask is mandatory. It must be used.
+ */
+ public static final int MANDATORY = 1;
+
+ /**
+ * The mask is exclusive. Only one of its mask values may be used.
+ */
+ public static final int EXCLUSIVE = 2;
+
+ /**
+ * The mask is a bitmask. Any combination of its values may be used.
+ */
+ public static final int BITMASK = 3;
+
+
+ // The current value of this unitmask
+ private int _mask;
+
+ // The default mask provided by the oprofile library
+ private int _defaultMask;
+
+ // The type of this unitmask
+ private int _maskType;
+
+ // Descriptions of the bits of this mask
+ private String[] _maskOptionDescriptions = new String[0];
+
+ // mask values -- now bit masks have distinct values (eg: an all of the
+ // above)
+ private int[] _maskOptionValues;
+
+ /**
+ * Set the descriptions and values for this unitmask's mask options.
+ * Only used from the XML parsers.
+ * @param masks a list of all the mask options
+ */
+ public void _setMaskDescriptions(MaskInfo[] masks) {
+ _maskOptionDescriptions = new String[masks.length];
+ _maskOptionValues = new int[masks.length];
+
+ for (int i = 0; i < masks.length; ++i) {
+ _maskOptionDescriptions[i] = masks[i].description;
+ _maskOptionValues[i] = masks[i].value;
+ }
+ }
+
+ /**
+ * Sets the default value for this unitmask, and initializes
+ * the current unitmask value to this default.
+ * Only used from the XML parsers.
+ * @param theDefault the default value
+ */
+ public void _setDefault(int theDefault) {
+ _defaultMask = theDefault;
+ setDefaultMaskValue();
+ }
+
+ /**
+ * Sets the unitmask type.
+ * Only used from the XML parsers.
+ * @param type the type
+ */
+ public void _setType(int type) {
+ _maskType = type;
+ }
+
+ /**
+ * Returns the integer value of this unitmask, suitable for passing to oprofile.
+ * @return the integer value
+ */
+ public int getMaskValue() {
+ return _mask;
+ }
+
+ /**
+ * Tests whether a particular mask is set in the unitmask value, based on the
+ * value of the mask option at the given index.
+ *
+ * @param index the index of the mask option to check
+ * @return whether the given mask option's value is set
+ */
+ public boolean isMaskSetFromIndex(int index) {
+ boolean result = false;
+
+ if (index >= 0 && index < _maskOptionValues.length) {
+ switch (_maskType) {
+ case EXCLUSIVE:
+ result = (_mask == _maskOptionValues[index]);
+ break;
+
+ case BITMASK:
+ result = ((_mask & _maskOptionValues[index]) != 0);
+ break;
+
+ default:
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Sets the absolute unitmask value.
+ *
+ * @param newValue the new value of this unitmask
+ */
+ public void setMaskValue(int newValue) {
+ if (newValue == SET_DEFAULT_MASK) {
+ _mask = _defaultMask;
+ } else {
+ _mask = newValue;
+ }
+ }
+
+ /**
+ * Sets the bits of the given mask option's value in the unitmask value.
+ * @param index the index of the mask option to set
+ */
+ public void setMaskFromIndex(int index) {
+ //mandatory masks only use the default value
+ if (index >= 0 && index < _maskOptionValues.length) {
+ if (_maskType == BITMASK)
+ _mask |= _maskOptionValues[index];
+ else if (_maskType == EXCLUSIVE) {
+ _mask = _maskOptionValues[index];
+ }
+ }
+ }
+
+ /**
+ * Returns the value of the mask based on the unitmask index.
+ * @param index the index of the mask option
+ * @return the mask option's value
+ */
+ public int getMaskFromIndex(int index) {
+ //mandatory masks only use the default value
+ if (_maskType == BITMASK) {
+ if (index >= 0 && index < _maskOptionValues.length) {
+ return _maskOptionValues[index];
+ }
+ } else if (_maskType == EXCLUSIVE) {
+ if (index >= 0 && index < _maskOptionValues.length) {
+ return _maskOptionValues[index];
+ }
+ } else if (_maskType == MANDATORY) {
+ return _defaultMask;
+ }
+
+ //type invalid or unknown, or out of bounds
+ return -1;
+ }
+
+ /**
+ * Unset the bits of the given mask option's value in the unitmask value.
+ * @param index the index of the mask option to set
+ */
+ public void unSetMaskFromIndex(int index) {
+ if (index >= 0 && index < _maskOptionValues.length && _maskType == BITMASK) {
+ _mask = _mask & ~_maskOptionValues[index];
+ }
+ }
+
+ /**
+ * Sets the current unitmask value to the default mask value.
+ */
+ public void setDefaultMaskValue() {
+ _mask = _defaultMask;
+ }
+
+ /**
+ * Returns a description of the requested mask option.
+ * @param num the mask option index
+ * @return the description
+ */
+ public String getText(int num) {
+ if (num >= 0 && num < _maskOptionDescriptions.length)
+ return _maskOptionDescriptions[num];
+
+ return null;
+ }
+
+ /**
+ * Returns the number of mask options in this unitmask.
+ * @return the number of mask options
+ */
+ public int getNumMasks() {
+ return _maskOptionDescriptions.length;
+ }
+
+ /**
+ * Returns the mask type for this unit mask.
+ * @return <code>BITMASK</code>, <code>EXCLUSIVE</code>, or
+ * <code>MANDATORY</code>
+ */
+ public int getType() {
+ return _maskType;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonEvent.java
new file mode 100644
index 0000000000..34ae43e559
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonEvent.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.daemon;
+
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+
+/**
+ * This class represents an event used to configure the OProfile
+ * daemon.
+ */
+public class OprofileDaemonEvent {
+ public static final int COUNT_UNINITIALIZED = 0;
+ public static final int COUNT_INVALID = -1;
+
+ // The event to collect on this counter
+ private OpEvent _event;
+
+ // Profile kernel?
+ private boolean _profileKernel;
+
+ // Profile userspace?
+ private boolean _profileUser;
+
+ // Reset counter value
+ private int _count;
+
+ public OprofileDaemonEvent() {
+ _profileKernel = true;
+ _profileUser = true;
+ _count = COUNT_UNINITIALIZED;
+ _event = null;
+ }
+
+ /**
+ * Set the event to collect
+ * @param event the OProfile event
+ */
+ public void setEvent(OpEvent event) {
+ _event = event;
+ }
+
+ /**
+ * Get the event to collect
+ * @returns the OProfile event
+ */
+ public OpEvent getEvent() {
+ return _event;
+ }
+
+ /**
+ * Set whether to profile the kernel
+ * @param profileKernel whether to enable kernel profiling
+ */
+ public void setProfileKernel(boolean profileKernel) {
+ _profileKernel = profileKernel;
+ }
+
+ /**
+ * Get whether to profile the kernel
+ * @return whether to profile the kernel
+ */
+ public boolean getProfileKernel() {
+ return _profileKernel;
+ }
+
+ /**
+ * Set whether to profile userspace
+ * @param profileUser whether to profile userspace
+ */
+ public void setProfileUser(boolean profileUser) {
+ _profileUser = profileUser;
+ }
+
+ /**
+ * Get whether to profile userspace
+ * @return whether to profile userspace
+ */
+ public boolean getProfileUser() {
+ return _profileUser;
+ }
+
+ /**
+ * Set the reset count
+ * @param count the new count
+ */
+ public void setResetCount(int count) {
+ _count = count;
+ }
+
+ /**
+ * Get the reset count
+ * @return the reset count
+ */
+ public int getResetCount() {
+ // FIXME: This isn't quite in the right place...
+ if (_count == COUNT_UNINITIALIZED) {
+ // This is what Oprofile does in oprof_start.cpp:
+ double speed = Oprofile.getCpuFrequency();
+ if (speed == 0.0) {
+ _count = _event.getMinCount() * 30;
+ } else {
+ _count = (int) speed * 20;
+ }
+ }
+
+ return _count;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonOptions.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonOptions.java
new file mode 100644
index 0000000000..d9cb574d96
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/daemon/OprofileDaemonOptions.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.daemon;
+
+
+/**
+ * This class represents the global launch options for the
+ * OProfile daemon.
+ */
+public class OprofileDaemonOptions {
+ // Kernel image file
+ private String _kernelImageFile;
+
+ // Enable verbose logging?
+ private boolean _verboseLogging;
+
+ // How to separate profiles (mask)
+ private int _separateProfiles;
+
+ // the image to profile
+ private String _binaryImage;
+
+ //how many calls down to profile
+ private int _callgraphDepth;
+
+ /**
+ * Sample separation options. Determines how oprofiled will group
+ * samples for binaries which isn't the main binary being profiled.
+ *
+ * Currently only properly support:
+ * -none: ignore all other binaries
+ * -library: include shared library samples
+ * -kernel: include kernel module samples (which implicitly includes library)
+ *
+ * the others probably wouldn't show nicely in the view
+ */
+ public static final int SEPARATE_NONE = 0;
+ public static final int SEPARATE_LIBRARY = 1;
+ public static final int SEPARATE_KERNEL = 2;
+ public static final int SEPARATE_THREAD = 4;
+ public static final int SEPARATE_CPU = 8;
+
+ public OprofileDaemonOptions() {
+ //defaults
+// _kernelImageFile = Oprofile.getKernelImageFile();
+ _kernelImageFile = ""; //$NON-NLS-1$
+ _verboseLogging = false;
+ _separateProfiles = SEPARATE_NONE;
+ _binaryImage = ""; //$NON-NLS-1$
+ _callgraphDepth = 0;
+ }
+
+ /**
+ * Get the kernel image file
+ * @return the kernel image file
+ */
+ public String getKernelImageFile() {
+ return _kernelImageFile;
+ }
+
+ /**
+ * Set the kernel image file
+ * @param image the kernel image
+ */
+ public void setKernelImageFile(String image) {
+ _kernelImageFile = image;
+ }
+
+ /**
+ * Get daemon verbose logging
+ * @return whether verbose logging is enabled
+ */
+ public boolean getVerboseLogging() {
+ return _verboseLogging;
+ }
+
+ /**
+ * Set daemon verbose logging
+ * @param logging whether to enable verbose logging
+ */
+ public void setVerboseLogging(boolean logging) {
+ _verboseLogging = logging;
+ }
+
+ /**
+ * Get daemon profile separation mask
+ * @return mask of options
+ */
+ public int getSeparateProfilesMask() {
+ return _separateProfiles;
+ }
+
+ /**
+ * Set daemon profile separation mask
+ * @param mask the new separation mask
+ */
+ public void setSeparateProfilesMask(int mask) {
+ _separateProfiles = mask;
+ }
+
+ /**
+ * Get the path to the binary image being profiled.
+ * @return full path to the binary
+ */
+ public String getBinaryImage() {
+ return _binaryImage;
+ }
+
+ /**
+ * Sets the path of the binary image to profile.
+ * @param _image full path to the binary
+ */
+ public void setBinaryImage(String _image) {
+ this._binaryImage = _image;
+ }
+
+ /**
+ * Get the call depth value.
+ * @return integer amount of calls down to profile
+ */
+ public int getCallgraphDepth() {
+ return _callgraphDepth;
+ }
+
+ /**
+ * Sets the call depth value.
+ * @param depth integer amount of calls down to profile
+ */
+ public void setCallgraphDepth(int depth) {
+ this._callgraphDepth = depth;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java
new file mode 100644
index 0000000000..72cc489dab
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java
@@ -0,0 +1,343 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.linuxtools.oprofile.core.IOpcontrolProvider;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+
+/**
+ * A class which encapsulates running opcontrol.
+ */
+public class LinuxOpcontrolProvider implements IOpcontrolProvider {
+ // Location of opcontrol security wrapper
+ private static final String _OPCONTROL_REL_PATH = "natives/linux/scripts/opcontrol"; //$NON-NLS-1$
+ private final String OPCONTROL_PROGRAM;
+
+ // Initialize the Oprofile kernel module and oprofilefs
+ private static final String _OPD_INIT_MODULE = "--init"; //$NON-NLS-1$
+
+ // Setup daemon collection arguments
+ private static final String _OPD_SETUP = "--setup"; //$NON-NLS-1$
+ private static final String _OPD_HELP = "--help"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE = "--separate="; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_SEPARATOR = ","; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_NONE = "none"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_LIBRARY = "library"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_KERNEL = "kernel"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_THREAD = "thread"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_SEPARATE_CPU = "cpu"; //$NON-NLS-1$
+
+ private static final String _OPD_SETUP_EVENT = "--event="; //$NON-NLS-1$
+ private static final String _OPD_SETUP_EVENT_SEPARATOR = ":"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_EVENT_TRUE = "1"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_EVENT_FALSE = "0"; //$NON-NLS-1$
+ private static final String _OPD_SETUP_EVENT_DEFAULT = "default"; //$NON-NLS-1$
+
+ private static final String _OPD_SETUP_IMAGE = "--image="; //$NON-NLS-1$
+
+ private static final String _OPD_CALLGRAPH_DEPTH = "--callgraph="; //$NON-NLS-1$
+
+ // Kernel image file options
+ private static final String _OPD_KERNEL_NONE = "--no-vmlinux"; //$NON-NLS-1$
+ private static final String _OPD_KERNEL_FILE = "--vmlinux="; //$NON-NLS-1$
+
+ // Logging verbosity
+// private static final String _OPD_VERBOSE_LOGGING = "--verbose="; //$NON-NSL-1$
+// private static final String _OPD_VERBOSE_ALL = "all"; //$NON-NLS-1$
+// private static final String _OPD_VERBOSE_SFILE = "sfile"; //$NON-NLS-1$
+// private static final String _OPD_VERBOSE_ARCS = "arcs"; //$NON-NLS-1$
+// private static final String _OPD_VERBOSE_SAMPLES = "samples"; //$NON-NLS-1$
+// private static final String _OPD_VERBOSE_MODULE = "module"; //$NON-NLS-1$
+// private static final String _OPD_VERBOSE_MISC = "misc"; //$NON-NLS-1$
+
+ // Start the daemon process without starting data collection
+ private static final String _OPD_START_DAEMON = "--start-daemon"; //$NON-NLS-1$
+
+ // Start collecting profiling data
+ private static final String _OPD_START_COLLECTION = "--start"; //$NON-NLS-1$
+
+ // Flush the collected profiling data to disk
+ private static final String _OPD_DUMP = "--dump"; //$NON-NLS-1$
+
+ // Stop data collection
+ private static final String _OPD_STOP_COLLECTION = "--stop"; //$NON-NLS-1$
+
+ // Stop data collection and stop daemon
+ private static final String _OPD_SHUTDOWN = "--shutdown"; //$NON-NLS-1$
+
+ // Clear out data from current session
+ private static final String _OPD_RESET = "--reset"; //$NON-NLS-1$
+
+ // Save data from the current session
+ private static final String _OPD_SAVE_SESSION = "--save="; //$NON-NLS-1$
+
+ // Unload the oprofile kernel module and oprofilefs
+ private static final String _OPD_DEINIT_MODULE = "--deinit"; //$NON-NLS-1$
+
+ // Logging verbosity. Specified with setupDaemon.
+ //--verbosity=all generates WAY too much stuff in the log
+ private String _verbosity = ""; //$NON-NLS-1$
+
+
+ public LinuxOpcontrolProvider() throws OpcontrolException {
+ OPCONTROL_PROGRAM = _findOpcontrol();
+ }
+
+ /**
+ * Unload the kernel module and oprofilefs
+ * @throws OpcontrolException
+ */
+ public void deinitModule() throws OpcontrolException {
+ _runOpcontrol(_OPD_DEINIT_MODULE);
+ }
+
+ /**
+ * Dump collected profiling data
+ * @throws OpcontrolException
+ */
+ public void dumpSamples() throws OpcontrolException {
+ _runOpcontrol(_OPD_DUMP);
+ }
+
+ /**
+ * Loads the kernel module and oprofilefs
+ * @throws OpcontrolException
+ */
+ public void initModule() throws OpcontrolException {
+ _runOpcontrol(_OPD_INIT_MODULE);
+ }
+
+ /**
+ * Clears out data from current session
+ * @throws OpcontrolException
+ */
+ public void reset() throws OpcontrolException {
+ _runOpcontrol(_OPD_RESET);
+ }
+
+ /**
+ * Saves the current ("default") session
+ * @param name the name to which to save the session
+ * @throws OpcontrolException
+ */
+ public void saveSession(String name) throws OpcontrolException {
+ ArrayList<String> cmd = new ArrayList<String>();
+ cmd.add(_OPD_SAVE_SESSION + name);
+ _runOpcontrol(cmd);
+ }
+
+ /**
+ * Give setup aruments
+ * @param args list of parameters for daemon
+ * @throws OpcontrolException
+ */
+ public void setupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) throws OpcontrolException {
+ // Convert options & events to arguments for opcontrol
+ ArrayList<String> args = new ArrayList<String>();
+ args.add(_OPD_SETUP);
+ _optionsToArguments(args, options);
+ if (!Oprofile.getTimerMode()) {
+ if (events == null || events.length == 0) {
+ args.add(_OPD_SETUP_EVENT + _OPD_SETUP_EVENT_DEFAULT);
+ } else {
+ for (int i = 0; i < events.length; ++i) {
+ _eventToArguments(args, events[i]);
+ }
+ }
+ }
+ _runOpcontrol(args);
+ }
+
+ /**
+ * Stop data collection and remove daemon
+ * @throws OpcontrolException
+ */
+ public void shutdownDaemon() throws OpcontrolException {
+ _runOpcontrol(_OPD_SHUTDOWN);
+ }
+
+ /**
+ * Start data collection (will start daemon if necessary)
+ * @throws OpcontrolException
+ */
+ public void startCollection() throws OpcontrolException {
+ _runOpcontrol(_OPD_START_COLLECTION);
+ }
+
+ /**
+ * Start daemon without starting profiling
+ * @throws OpcontrolException
+ */
+ public void startDaemon() throws OpcontrolException {
+ _runOpcontrol(_OPD_START_DAEMON);
+ }
+
+ /**
+ * Stop data collection
+ * @throws OpcontrolException
+ */
+ public void stopCollection() throws OpcontrolException {
+ _runOpcontrol(_OPD_STOP_COLLECTION);
+ }
+
+ /**
+ * Check status. returns true if any status was returned
+ * @throws OpcontrolException
+ */
+ public boolean status() throws OpcontrolException {
+ return _runOpcontrol(_OPD_HELP);
+ }
+
+ // Convenience function
+ private boolean _runOpcontrol(String cmd) throws OpcontrolException {
+ ArrayList<String> list = new ArrayList<String>();
+ list.add(cmd);
+ return _runOpcontrol(list);
+ }
+
+ // Will add opcontrol program to beginning of args
+ // args: list of opcontrol arguments (not including opcontrol program itself)
+ /**
+ * @return true if any output was produced on the error stream. Unfortunately
+ * this appears to currently be the only way we can tell if user correctly
+ * entered the password
+ */
+ private boolean _runOpcontrol(ArrayList<String> args) throws OpcontrolException {
+ args.add(0, OPCONTROL_PROGRAM);
+ // Verbosity hack. If --start or --start-daemon, add verbosity, if set
+ String cmd = (String) args.get(1);
+ if (_verbosity.length() > 0 && (cmd.equals (_OPD_START_COLLECTION) || cmd.equals(_OPD_START_DAEMON))) {
+ args.add(_verbosity);
+ }
+
+ String[] cmdArray = new String[args.size()];
+ args.toArray(cmdArray);
+
+ Process p = null;
+ try {
+ p = Runtime.getRuntime().exec(cmdArray);
+ } catch (IOException ioe) {
+ if (p != null) {
+ p.destroy();
+ p = null;
+ }
+
+ throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun", ioe)); //$NON-NLS-1$
+ }
+
+ if (p != null) {
+ BufferedReader errout = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ String output = "", s; //$NON-NLS-1$
+ try {
+ while ((s = errout.readLine()) != null) {
+ output += s;
+ }
+
+ int ret = p.waitFor();
+ if (ret != 0) {
+ System.out.println(output);
+ throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolNonZeroExitCode", null)); //$NON-NLS-1$
+ }
+
+ if (output.length() != 0) {
+ return true;
+ }
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ private static String _findOpcontrol() throws OpcontrolException {
+ URL url = FileLocator.find(Platform.getBundle(OprofileCorePlugin.getId()), new Path(_OPCONTROL_REL_PATH), null);
+
+ if (url != null) {
+ try {
+ return FileLocator.toFileURL(url).getPath();
+ } catch (IOException ignore) { }
+ } else {
+ throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolProvider", null)); //$NON-NLS-1$
+ }
+
+ return null;
+ }
+
+ // Convert the event into arguments for opcontrol
+ private void _eventToArguments(ArrayList<String> args, OprofileDaemonEvent event) {
+ // Event spec: "EVENT:count:mask:profileKernel:profileUser"
+ String spec = new String(_OPD_SETUP_EVENT);
+ spec += event.getEvent().getText();
+ spec += _OPD_SETUP_EVENT_SEPARATOR;
+ spec += event.getResetCount();
+ spec += _OPD_SETUP_EVENT_SEPARATOR;
+ spec += event.getEvent().getUnitMask().getMaskValue();
+ spec += _OPD_SETUP_EVENT_SEPARATOR;
+ spec += (event.getProfileKernel() ? _OPD_SETUP_EVENT_TRUE : _OPD_SETUP_EVENT_FALSE);
+ spec += _OPD_SETUP_EVENT_SEPARATOR;
+ spec += (event.getProfileUser() ? _OPD_SETUP_EVENT_TRUE : _OPD_SETUP_EVENT_FALSE);
+ args.add(spec);
+ }
+
+ // Convert the options into arguments for opcontrol
+ private void _optionsToArguments(ArrayList<String> args, OprofileDaemonOptions options) {
+ // Add separate flags
+ int mask = options.getSeparateProfilesMask();
+
+ String separate = new String(_OPD_SETUP_SEPARATE);
+
+ if (mask == OprofileDaemonOptions.SEPARATE_NONE) {
+ separate += _OPD_SETUP_SEPARATE_NONE;
+ } else {
+ //note that opcontrol will nicely ignore the trailing comma
+ if ((mask & OprofileDaemonOptions.SEPARATE_LIBRARY) != 0)
+ separate += _OPD_SETUP_SEPARATE_LIBRARY + _OPD_SETUP_SEPARATE_SEPARATOR;
+ if ((mask & OprofileDaemonOptions.SEPARATE_KERNEL) != 0)
+ separate += _OPD_SETUP_SEPARATE_KERNEL + _OPD_SETUP_SEPARATE_SEPARATOR;
+ if ((mask & OprofileDaemonOptions.SEPARATE_THREAD) != 0)
+ separate += _OPD_SETUP_SEPARATE_THREAD + _OPD_SETUP_SEPARATE_SEPARATOR;
+ if ((mask & OprofileDaemonOptions.SEPARATE_CPU) != 0)
+ separate += _OPD_SETUP_SEPARATE_CPU + _OPD_SETUP_SEPARATE_SEPARATOR;
+ }
+ args.add(separate);
+
+ // Add kernel image
+ if (options.getKernelImageFile() == null || options.getKernelImageFile().length() == 0) {
+ args.add(_OPD_KERNEL_NONE);
+ } else {
+ args.add(_OPD_KERNEL_FILE + options.getKernelImageFile());
+ }
+
+ //image filter -- always non-null
+ args.add(_OPD_SETUP_IMAGE + options.getBinaryImage());
+
+ //callgraph depth
+ args.add(_OPD_CALLGRAPH_DEPTH + options.getCallgraphDepth());
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpxmlProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpxmlProvider.java
new file mode 100644
index 0000000000..b5be556eec
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpxmlProvider.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.linuxtools.oprofile.core.IOpxmlProvider;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.opxml.OpxmlConstants;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.eclipse.linuxtools.oprofile.core.opxml.sessions.SessionsProcessor;
+
+/**
+ * A class which implements the IOpxmlProvider interface for running opxml.
+ */
+public abstract class LinuxOpxmlProvider implements IOpxmlProvider {
+ private String _pathToOpxml;
+
+ public LinuxOpxmlProvider() throws OpxmlException {
+ _pathToOpxml = _getOpxmlPath();
+
+ if (_pathToOpxml == null) {
+ throw new OpxmlException(OprofileCorePlugin.createErrorStatus("opxmlProvider", null)); //$NON-NLS-1$
+ }
+ }
+
+ public abstract String _getOpxmlPath();
+
+ public IRunnableWithProgress info(final OpInfo info) {
+ return new OpInfoRunner(info);
+ }
+
+ //public because it is used in OpInfo.java:getInfo()
+ public class OpInfoRunner implements IRunnableWithProgress {
+ private boolean b;
+ final private OpInfo info;
+
+ public OpInfoRunner(OpInfo _info) {
+ info = _info;
+ }
+
+ public boolean run0(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ run(monitor);
+ return b;
+ }
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ OpxmlRunner runner = new OpxmlRunner(_pathToOpxml);
+ String[] args = new String[] {
+ OpxmlConstants.OPXML_INFO
+ };
+ b = runner.run(args, info);
+ }
+ }
+
+ public IRunnableWithProgress modelData(final String eventName, final String sessionName, final OpModelImage image) {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ OpxmlRunner runner = new OpxmlRunner(_pathToOpxml);
+
+ String[] args = new String[] {
+ OpxmlConstants.OPXML_MODELDATA,
+ eventName,
+ sessionName
+ };
+
+ ModelDataProcessor.CallData data = new ModelDataProcessor.CallData(image);
+ runner.run(args, data);
+ }
+ };
+
+ return runnable;
+ }
+
+ public IRunnableWithProgress checkEvents(final int ctr, final int event, final int um, final int[] eventValid) {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ OpxmlRunner runner = new OpxmlRunner(_pathToOpxml);
+ String[] args = new String[] {
+ OpxmlConstants.CHECKEVENTS_TAG,
+ Integer.toString(ctr),
+ Integer.toString(event),
+ Integer.toString(um)
+ };
+
+ runner.run(args, eventValid);
+ }
+ };
+ return runnable;
+ }
+
+ public IRunnableWithProgress sessions(final ArrayList<OpModelEvent> sessionList) {
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ OpxmlRunner runner = new OpxmlRunner(_pathToOpxml);
+ String[] args = new String[] {
+ OpxmlConstants.OPXML_SESSIONS,
+ };
+
+ SessionsProcessor.SessionInfo sinfo = new SessionsProcessor.SessionInfo(sessionList);
+ runner.run(args, sinfo);
+ }
+ };
+
+ return runnable;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java
new file mode 100644
index 0000000000..3a7c02ae05
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.linux;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * This class will run opxml.
+ *
+ * opxml is a small program which acts as a textual interface between Oprofile and
+ * BFD and the oprofile plugins.
+ */
+public class OpxmlRunner {
+ private OprofileSAXHandler _handler;
+ private String _pathToOpxml;
+
+ public OpxmlRunner(String pathToOpxml) {
+ //assume that the path given is valid
+ _pathToOpxml = pathToOpxml;
+ }
+
+ /**
+ * Returns the current XMLProcessor handling parsing of opxml output.
+ * @return the processor
+ */
+ public XMLProcessor getProcessor() {
+ return _handler.getProcessor();
+ }
+
+ /**
+ * Runs opxml with the given arguments.
+ * @param args the arguments to pass to opxml
+ * @param callData any callData to pass to the processor
+ * @return boolean indicating the success/failure of opxml
+ * @throws OpxmlException
+ */
+ public boolean run(String[] args, Object callData) {
+ XMLReader reader = null;
+ _handler = OprofileSAXHandler.getInstance(callData);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ try {
+ reader = factory.newSAXParser().getXMLReader();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ // Set content/error handlers
+ reader.setContentHandler(_handler);
+ reader.setErrorHandler(_handler);
+
+ // Setup args
+ String[] cmdArray = new String[args.length + 1];
+ cmdArray[0] = _pathToOpxml;
+ System.arraycopy(args, 0, cmdArray, 1, args.length);
+
+ // Run opxml
+ try {
+ Process p = Runtime.getRuntime().exec(cmdArray);
+ BufferedReader bi = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ reader.parse(new InputSource(bi));
+ int ret = p.waitFor();
+ if (ret != 0) {
+ //System.out.println("error running opxml");
+ return false;
+ }
+
+ return true;
+ } catch (SAXException e) {
+ e.printStackTrace();
+ OprofileCorePlugin.showErrorDialog("opxmlSAXParseException", null); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+// System.out.println("IOException: " + e.getMessage());
+ e.printStackTrace();
+ OprofileCorePlugin.showErrorDialog("opxmlIOException", null); //$NON-NLS-1$
+ }
+
+ return false;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelEvent.java
new file mode 100644
index 0000000000..bd4fab78a7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelEvent.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.model;
+
+/**
+ * A class which represents the event collected in a given session.
+ */
+public class OpModelEvent {
+ private String _eventName;
+ private OpModelSession[] _sessions;
+ private String _printTabs = ""; //for nice output //$NON-NLS-1$
+
+ public OpModelEvent(String name) {
+ _eventName = name;
+ }
+
+ public OpModelSession[] getSessions() {
+ return _sessions;
+ }
+
+ public void _setSessions(OpModelSession[] sessions) {
+ _sessions = sessions;
+ }
+
+ public String getName() {
+ return _eventName;
+ }
+
+ //populate all sessions
+ public void refreshModel() {
+ if (_sessions != null) {
+ for (int i = 0; i < _sessions.length; i++) {
+ _sessions[i].refreshModel();
+ }
+ }
+ }
+
+ public String toString(String tabs) {
+ _printTabs = tabs;
+ String s = toString();
+ _printTabs = ""; //$NON-NLS-1$
+ return s;
+ }
+
+ @Override
+ public String toString() {
+ String s = _eventName + "\n"; //$NON-NLS-1$
+ if (_sessions != null) {
+ for (int i = 0; i < _sessions.length; i++) {
+ s += _printTabs + "Session: "; //$NON-NLS-1$
+ s += _sessions[i].toString(_printTabs + "\t"); //$NON-NLS-1$
+ }
+ }
+ return s;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelImage.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelImage.java
new file mode 100644
index 0000000000..2686dfdd5d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelImage.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.model;
+
+
+/**
+ * A class which represents an image (executables,
+ * libraries, modules) profile by OProfile.
+ */
+public class OpModelImage {
+ public static final int IMAGE_PARSE_ERROR = -1;
+
+ //The count of all samples from this image
+ private int _count;
+
+ //the count for all dependent images -- needed?
+ private int _depcount;
+
+ //The name of this image (the full path, where applicable)
+ private String _name;
+
+ //The symbols profiled in this image
+ private OpModelSymbol[] _symbols;
+
+ //Any dependent images on this image (usually shared libs, kernel modules)
+ private OpModelImage[] _dependents;
+
+ private String _printTabs = ""; //for nice output //$NON-NLS-1$
+
+ public OpModelImage() {
+ _name = ""; //$NON-NLS-1$
+ _count = 0;
+ _depcount = 0;
+ _symbols = null;
+ _dependents = null;
+ }
+
+ public int getCount() {
+ return _count;
+ }
+
+ public int getDepCount() {
+ return _depcount;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public OpModelSymbol[] getSymbols() {
+ return _symbols;
+ }
+
+ public OpModelImage[] getDependents() {
+ return _dependents;
+ }
+
+ public boolean hasDependents() {
+ return (_dependents == null || _dependents.length == 0 ? false : true);
+ }
+
+ /**
+ * This method is not meant to be called publicly, used only
+ * from the XML processors
+ * @param _count
+ */
+ public void _setCount(int _count) {
+ this._count = _count;
+ }
+
+ /**
+ * This method is not meant to be called publicly, used only
+ * from the XML processors
+ * @param _depcount
+ */
+ public void _setDepCount(int _depcount) {
+ this._depcount = _depcount;
+ }
+
+ /**
+ * This method is not meant to be called publicly, used only
+ * from the XML processors
+ * @param _name
+ */
+ public void _setName(String _name) {
+ this._name = _name;
+ }
+
+ /**
+ * This method is not meant to be called publicly, used only
+ * from the XML processors
+ * @param _symbols
+ */
+ public void _setSymbols(OpModelSymbol[] _symbols) {
+ this._symbols = _symbols;
+ }
+
+ /**
+ * This method is not meant to be called publicly, used only
+ * from the XML processors
+ * @param _dependents
+ */
+ public void _setDependents(OpModelImage[] _dependents) {
+ this._dependents = _dependents;
+ }
+
+ public String toString(String tabs) {
+ _printTabs = tabs;
+ String s = toString();
+ _printTabs = ""; //$NON-NLS-1$
+ return s;
+ }
+
+ @Override
+ public String toString() {
+ String s = _name + ", Count: " + _count + (_depcount !=0 ? ", Dependent Count: " + _depcount + "\n" : "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ if (_symbols != null) {
+ for (int i = 0; i < _symbols.length; i++) {
+ s += _printTabs + "Symbols: "; //$NON-NLS-1$
+ s += _symbols[i].toString(_printTabs + "\t"); //$NON-NLS-1$
+ }
+ }
+ if (_dependents != null) {
+ for (int i = 0; i < _dependents.length; i++) {
+ s += _printTabs + "Dependent Image: "; //$NON-NLS-1$
+ s += _dependents[i].toString(_printTabs + "\t"); //$NON-NLS-1$
+ }
+ }
+ return s;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelRoot.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelRoot.java
new file mode 100644
index 0000000000..d0db8e2c62
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelRoot.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.model;
+
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+
+/**
+ * A root node for the data model. Only one instance exists at any time,
+ * although the contents will change. On instantiation the events and
+ * sessions are gathered.
+ *
+ * Note that this data model does not map 1:1 to the oprofile data model.
+ * This model is for use in profiling one application compiled with debug
+ * info, from within eclipse.
+ */
+
+public class OpModelRoot {
+ //single instance
+ private static OpModelRoot _modelRoot = new OpModelRoot();
+
+ private OpModelEvent[] _events;
+// private String _printTabs = "\t"; //for nice output
+
+ protected OpModelRoot() {
+// refreshModel();
+ _events = null;
+// _modelRoot = this;
+ }
+
+ public static OpModelRoot getDefault() {
+ return _modelRoot;
+ }
+
+ public void refreshModel() {
+ //TODO-performance/interactivity: some persistence for events/sessions
+ // that dont change from run to run (non default sessions)
+
+ _events = getNewEvents();
+ if (_events != null) {
+ for (int i = 0; i < _events.length; i++) {
+ if (_events[i] != null)
+ _events[i].refreshModel();
+ }
+ }
+ }
+
+ protected OpModelEvent[] getNewEvents() {
+ //launch `opxml sessions`, gather up events & the sessions under them
+ return Oprofile.getEvents();
+ }
+
+ public OpModelEvent[] getEvents() {
+ return _events;
+ }
+
+ @Override
+ public String toString() {
+ String s = ""; //$NON-NLS-1$
+ if (_events != null) {
+ for (int i = 0; i < _events.length; i++) {
+ if (_events[i] != null) {
+ s += "Event: "; //$NON-NLS-1$
+ s += _events[i].toString("\t"); //$NON-NLS-1$
+ }
+ }
+ }
+ return s;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSample.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSample.java
new file mode 100644
index 0000000000..a705c09aff
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSample.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.model;
+
+/**
+ * Represents an OProfile sample.
+ */
+public class OpModelSample {
+ private int _count;
+ private int _line;
+
+ public OpModelSample() {
+ _count = 0;
+ _line = 0;
+ }
+
+ public void _setCount(int _count) {
+ this._count = _count;
+ }
+
+ public void _setLine(int _line) {
+ this._line = _line;
+ }
+
+ public int getCount() {
+ return _count;
+ }
+
+ public int getLine() {
+ return _line;
+ }
+
+ @Override
+ public String toString() {
+ String s = "Line #: " + _line + ", Count: " + _count + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return s;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSession.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSession.java
new file mode 100644
index 0000000000..aa8964d781
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSession.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.model;
+
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+
+
+/**
+ * This class represents oprofile sessions. Sessions contain an image
+ * of the profiled binary.
+ */
+public class OpModelSession {
+ private static final String DEFAULT_SESSION_STRING = "current"; //$NON-NLS-1$
+
+ private OpModelEvent _parentEvent;
+ private OpModelImage _image;
+ private String _name;
+ private String _printTabs = ""; //for nice output //$NON-NLS-1$
+
+ public OpModelSession(OpModelEvent event, String name) {
+ _parentEvent = event;
+ _name = name;
+ _image = null;
+ }
+
+ public OpModelImage getImage() {
+ return _image;
+ }
+
+ public OpModelEvent getEvent() {
+ return _parentEvent;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public int getCount() {
+ if (_image == null) {
+ return 0;
+ } else {
+ return _image.getCount();
+ }
+ }
+
+ public boolean isDefaultSession() {
+ return _name.equals(DEFAULT_SESSION_STRING);
+ }
+
+ public void refreshModel() {
+ //populate this session with samples
+ _image = getNewImage();
+ }
+
+ protected OpModelImage getNewImage() {
+ return Oprofile.getModelData(_parentEvent.getName(), _name);
+ }
+
+ public String toString(String tabs) {
+ _printTabs = tabs;
+ String s = toString();
+ _printTabs = ""; //$NON-NLS-1$
+ return s;
+ }
+
+ @Override
+ public String toString() {
+ String s = _name + "\n"; //$NON-NLS-1$
+ if (_image != null) {
+ s += _printTabs + "Image: "; //$NON-NLS-1$
+ s += _image.toString(_printTabs + "\t"); //$NON-NLS-1$
+ }
+ return s;
+
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSymbol.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSymbol.java
new file mode 100644
index 0000000000..9f07f823c9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/model/OpModelSymbol.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.model;
+
+/**
+ * This class represents a debugging symbol, the symbol output
+ * from opxml. If a symbol exists, it must have samples (which are
+ * OpModelSamples), although those samples may or may not have
+ * complete debug info.
+ */
+public class OpModelSymbol {
+ private String _name;
+ private String _file;
+ private int _count;
+ private OpModelSample[] _samples;
+ private String _printTabs = ""; //for nice output //$NON-NLS-1$
+
+ public OpModelSymbol() {
+ _name = ""; //$NON-NLS-1$
+ _file = ""; //$NON-NLS-1$
+ _count = 0;
+ _samples = null;
+ }
+
+ public void _setName(String _name) {
+ this._name = _name;
+ }
+
+ public void _setFile(String _file) {
+ this._file = _file;
+ }
+
+ public void _setCount(int _count) {
+ this._count = _count;
+ }
+
+ public void _setSamples(OpModelSample[] _samples) {
+ this._samples = _samples;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public String getFile() {
+ return _file;
+ }
+
+ public int getCount() {
+ return _count;
+ }
+
+ public OpModelSample[] getSamples() {
+ return _samples;
+ }
+
+ public String toString(String tabs) {
+ _printTabs = tabs;
+ String s = toString();
+ _printTabs = ""; //$NON-NLS-1$
+ return s;
+ }
+
+ @Override
+ public String toString() {
+ String s = _name + ", File: " + _file + ", Count: " + _count + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (_samples != null) {
+ for (int i = 0; i < _samples.length; i++) {
+ s += _printTabs + "Sample: "; //$NON-NLS-1$
+ s += _samples[i].toString();
+ }
+ }
+ return s;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/oprofile.properties b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/oprofile.properties
new file mode 100644
index 0000000000..9974f6baf3
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/oprofile.properties
@@ -0,0 +1,49 @@
+######################################################################
+# Copyright (c) 2004, 2008, 2009 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:
+# Keith Seitz <keiths@redhat.com> - Initial implementation
+# Kent Sebastian <ksebasti@redhat.com>
+######################################################################
+unknown-kernel=unknown
+getSamples.caption=Reading samples for session \"{0}\"...
+getSamples.caption.default-session=Reading samples for session \"Default\"...
+
+oprofileInit.error.statusMessage=An error occurred initializing OProfile for use with the plugin. Try loading the kernel module via OProfile itself with the command `opcontrol --init` (must be run as root).
+oprofileInit.error.dialog.title=Error initializing OProfile
+oprofileInit.error.dialog.message=FATAL: The OProfile kernel module could not be loaded.
+
+opcontrolRun.error.statusMessage=Error during run of opcontrol
+opcontrolNonZeroExitCode.error.statusMessage=Exit code of opcontrol indicates failure
+
+opcontrolProvider.error.statusMessage=Could not find an OpcontrolProvider, or no opcontrol binary exists.\n\nPlease ensure you have run the install script as the root user. The install script will be in the org.eclipse.linuxtools.oprofile.core plugin, which may be located in one of a few places. You can locate it with the following command (type in a terminal):\n\nfind <~/.eclipse OR the location from which you're running eclipse> \ \n-name 'org.eclipse.linuxtools.oprofile.core_*'\n\nWhen you have found the location of the plugin, change to the following directory:\n\ncd <path to org.eclipse.linuxtools.oprofile.core>/natives/linux/opxml\n\nMake sure you have all the dependencies listed in the README file, and then build the native component:\n\nmake\nmake install\n\nFinally, as root, run the install script contained therein:\n\ncd <path to org.eclipse.linuxtools.oprofile.core>/natives/linux/scripts\nsh install.sh\n\nYou may need to set the script as executable before running this command; do this with:\n\nchmod u+x install.sh
+
+opcontrolProvider.error.dialog.title=Error running opcontrol
+opcontrolProvider.error.dialog.message=FATAL: An error occurred running opcontrol.
+
+opxmlParse.error.statusMessage=An unexpected error occurred with parsing opxml's output. Please file a bug at http://bugs.eclipse.org/bugs.
+opxmlParse.error.dialog.title=Error with opxml
+opxmlParse.error.dialog.message=An error occurred with opxml.
+
+opxmlIOException.error.statusMessage=The opxml binary can not be read or executed. Either your user does not have sufficient permissions, or the install script was not run.\n\nPlease ensure you have run the install script as the root user. The install script will be in the org.eclipse.linuxtools.oprofile.core plugin, which may be located in one of a few places. You can locate it with the following command (type in a terminal):\n\nfind <~/.eclipse OR the location from which you're running eclipse> -name 'org.eclipse.linuxtools.oprofile.core_*'\n\nWhen you have found the location of the plugin, change to the following directory:\n\ncd <path to org.eclipse.linuxtools.oprofile.core>/natives/linux/opxml\n\n Make sure you have all the dependencies listed in the README file, and then build the native component\n\nmake\nmake install\n\nFinally, as root, run the install script contained therein:\n\ncd <path to org.eclipse.linuxtools.oprofile.core>/natives/linux/scripts\nsh install.sh\n\nYou may need to set the script as executable before running this command; do this with:\n\nchmod u+x install.sh
+opxmlIOException.error.dialog.title=Error with opxml
+opxmlIOException.error.dialog.message=FATAL: An error occurred with opxml.
+
+opxmlSAXParseException.error.statusMessage=The XML output could not be read, most likely a fatal error. Please see the "Errors Related to opxml" section in the OProfile user guide on the Eclipse.org wiki (http://wiki.eclipse.org/Linux_Tools_Project/OProfile/User_Guide#Errors_Related_to_opxml) or in the Eclipse Help docs.
+opxmlSAXParseException.error.dialog.title=Error with opxml
+opxmlSAXParseException.error.dialog.message=An error occurred with opxml.
+
+opxmlProvider.error.statusMessage=Could not find an OpxmlProvider, or no opxml binary exists. Please fix the issue before continuing.
+opxmlProvider.error.dialog.title=Error with opxml
+opxmlProvider.error.dialog.message=FATAL: An error occurred with opxml.
+
+fatal.kernelModuleNotLoaded=OProfile kernel module not loaded or no opcontrol. Please fix the issue and restart Eclipse.
+fatal.opinfoNotParsed=Fatal error: core OProfile information failed to parse. Please fix the issue and restart Eclipse.
+
+ui.annotate.no.sessions.error.statusMessage=There are no sessions to annotate. Please profile a binary.
+ui.annotate.no.sessions.error.dialog.title=Annotation Error
+ui.annotate.no.sessions.error.dialog.message=Error annotating
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java
new file mode 100644
index 0000000000..cf2fb22876
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OprofileSAXHandler.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml;
+
+import java.util.HashMap;
+import java.util.Stack;
+
+import org.eclipse.linuxtools.oprofile.core.opxml.checkevent.CheckEventsProcessor;
+import org.eclipse.linuxtools.oprofile.core.opxml.info.OpInfoProcessor;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.eclipse.linuxtools.oprofile.core.opxml.sessions.SessionsProcessor;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * The SAX handler class that is used to parse the output of opxml.
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class OprofileSAXHandler extends DefaultHandler {
+ // The only allowed instance of this class
+ private static OprofileSAXHandler _instance = null;
+
+ // A Map of all the XML processors for opxml
+ private static HashMap<String,Class<?>> _processors = new HashMap<String,Class<?>>();
+
+ // The current processor being used to parse the document
+ private XMLProcessor _processor = null;
+ private Object _callData;
+
+ /* A stack of XML processors. This allows processors to invoke sub-processors
+ for handling nested tags more efficiently. */
+ private Stack<XMLProcessor> _processorStack = new Stack<XMLProcessor>();
+
+ // A convenience class for specifying XMLProcessors
+ private static class ProcessorItem {
+ public String tagName;
+ public Class<?> handlerClass;
+ public ProcessorItem(String name, Class<?> cls) {
+ tagName = name;
+ handlerClass = cls;
+ }
+ }
+
+ // The list of all "root" XML tags and their handler classes
+ private static final ProcessorItem[] _handlerList = {
+ new ProcessorItem(OpxmlConstants.INFO_TAG, OpInfoProcessor.class),
+ new ProcessorItem(OpxmlConstants.CHECKEVENTS_TAG, CheckEventsProcessor.class),
+ new ProcessorItem(OpxmlConstants.MODELDATA_TAG, ModelDataProcessor.class),
+ new ProcessorItem(OpxmlConstants.SESSIONS_TAG, SessionsProcessor.class)
+ };
+
+ /**
+ * Returns an instance of the handler. This must be used to access the parser!
+ * @return a handler instance
+ */
+ public static OprofileSAXHandler getInstance(Object callData) {
+ if (_instance == null) {
+ _instance = new OprofileSAXHandler();
+
+ // Initialize processor map
+ for (int i = 0; i < _handlerList.length; ++i) {
+ _processors.put(_handlerList[i].tagName, _handlerList[i].handlerClass);
+ }
+ }
+
+ // Set calldata into handler
+ _instance.setCallData (callData);
+ return _instance;
+ }
+
+ /**
+ * Sets the calldata for the processor.
+ * @param callData the calldata to pass to the processor
+ */
+ public void setCallData(Object callData)
+ {
+ _callData = callData;
+ }
+
+ /**
+ * Returns the processor for a given request type.
+ * @param type the name of the processor
+ * @return the requested processor or null
+ */
+ public static XMLProcessor getProcessor(String type) {
+ XMLProcessor processor = null;
+
+ Class<?> handlerClass = (Class<?>) _processors.get(type);
+ if (handlerClass != null) {
+ try {
+ processor = (XMLProcessor) handlerClass.newInstance();
+ } catch (InstantiationException e) {
+ } catch (IllegalAccessException e) {
+ }
+ }
+
+ return processor;
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#startDocument()
+ */
+ public void startDocument() {
+ // Reset processor
+ _processor = null;
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#endDocument()
+ */
+ public void endDocument() {
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
+ */
+ public void startElement(String uri, String lName, String qName, Attributes attrs) {
+ if (_processor == null) {
+ // Get processor for this event type
+ _processor = getProcessor(qName);
+ _processor.reset(_callData);
+ }
+
+ // If we already have a processor, so let it deal with this new element.
+ // Allow the processor to deal with it's own tag as well: this way it can
+ // grab attributes from it.
+ _processor.startElement(qName, attrs, _callData);
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#endElement(String, String, String)
+ */
+ public void endElement(String uri, String name, String qName) {
+ _processor.endElement(qName, _callData);
+ }
+
+ /**
+ * @see org.xml.sax.ContentHandler#characters(char[], int, int)
+ */
+ public void characters(char ch[], int start, int length) {
+ // Ignore characters which are only whitespace
+ String str = new String(ch, start, length).trim();
+ if (str.length() > 0 && _processor != null)
+ _processor.characters(new String(ch, start, length), _callData);
+ }
+
+ /**
+ * Returns the processor used to parse the document.
+ * @return the XMLProcessor
+ */
+ public XMLProcessor getProcessor() {
+ return _processor;
+ }
+
+ /**
+ * Pushes the current XMLProcessor onto the stack and installs the given
+ * processor as the document's parser/handler.
+ * @param proc the processor to continue parsing the document
+ */
+ public void push(XMLProcessor proc) {
+ _processorStack.add(_processor);
+ _processor = proc;
+ _processor.reset(_callData);
+ }
+
+ /**
+ * Removes the current XMLProcessor and installs the previous processor.
+ * NOTE: This assumes that endElement caused the pop, so it calls endElement in
+ * the parent processor.
+ * @param tag the XML tag to pass to the parent processor
+ */
+ public void pop(String tag) {
+ _processor = (XMLProcessor) _processorStack.pop();
+ _processor.endElement(tag, _callData);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OpxmlConstants.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OpxmlConstants.java
new file mode 100644
index 0000000000..3a0f62a085
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/OpxmlConstants.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> - change samples to model-data
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml;
+
+/**
+ * A class of constants for communications with the opxml wrapper
+ * program.
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler
+ */
+public class OpxmlConstants {
+ /**
+ * Request static oprofile information (num counters, defaults, event lists)
+ */
+ public static final String OPXML_INFO = "info"; //$NON-NLS-1$
+ public static final String INFO_TAG = OPXML_INFO;
+
+ /**
+ * Request model data for a session
+ */
+ public static final String OPXML_MODELDATA = "model-data"; //$NON-NLS-1$
+ public static final String MODELDATA_TAG = OPXML_MODELDATA;
+
+ /**
+ * Request event validity check
+ */
+ public static final String OPXML_CHECKEVENTS = "check-events"; //$NON-NLS-1$
+ public static final String CHECKEVENTS_TAG = OPXML_CHECKEVENTS;
+
+ /**
+ * Request session list
+ */
+ public static final String OPXML_SESSIONS = "sessions"; //$NON-NLS-1$
+ public static final String SESSIONS_TAG = OPXML_SESSIONS;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/XMLProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/XMLProcessor.java
new file mode 100644
index 0000000000..85229fdc7e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/XMLProcessor.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml;
+
+import org.xml.sax.Attributes;
+
+/**
+ * A class which (minimally) parses XML documents. This class provides only basic
+ * support for collecting information from XML documents. It is intended to be subclassed,
+ * providing only common functionality for all parser classes.
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class XMLProcessor {
+ // The characters in the current tag
+ protected String _characters;
+
+ /**
+ * This method is called whenever the SAXHandler is about to invoke the
+ * processor for the first time on a given document.
+ * @param callData call data for the processor (usually the result is stored here)
+ */
+ public void reset(Object callData) {
+ };
+
+ /**
+ * This method is called whenever a new tag is seen in the document. By default,
+ * this process will clear the characters collected for the tag. Processors will typically
+ * call this baseclass method to setup for collecting new character information for a
+ * tag.
+ * @param name the name of the tag
+ * @param attrs the tag's attributes
+ * @param callData call data for the processor (usually the result is stored here)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ _characters = new String();
+ }
+
+ /**
+ * This method is called whenever the closing tag for an element is seen in the
+ * document.
+ * @param name the element which is ending
+ * @param callData call data for the processor (usually the result is stored here)
+ */
+ public void endElement(String name, Object callData) {
+ }
+
+ /**
+ * This method is called whenever characters are seen in the document that are not in
+ * a markup tag.
+ * @param chars the characters read
+ * @param callData call data for the processor (usually the result is stored here)
+ */
+ public void characters(String chars, Object callData) {
+ _characters = chars;
+ }
+
+ /**
+ * This method is called on attribute strings and does the reverse of valid_string in
+ * xmlfmt.cc in opxml.
+ * @param source source attribute string
+ * @return the source string with escaped characters translated back to their single character counterpart
+ */
+ public String valid_string(String source) {
+ final String chars_long[] = {"&amp;", "&quot;", "&apos;", "&lt;", "&gt;"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ final String chars[] = {"&", "\"", "'", "<", ">"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ for (int i = 0; i < chars_long.length; i++) {
+ source.replaceAll(chars_long[i], chars[i]);
+ }
+ return source;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/checkevent/CheckEventsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/checkevent/CheckEventsProcessor.java
new file mode 100644
index 0000000000..79c8a582fb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/checkevent/CheckEventsProcessor.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.checkevent;
+
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+
+/**
+ * XML handler class for opxml's "check-events".
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class CheckEventsProcessor extends XMLProcessor {
+ public static final int INVALID_UNKNOWN = 0; //unexpected error
+ public static final int EVENT_OK = 1; //valid
+ public static final int INVALID_EVENT = 2; //invalid event number
+ public static final int INVALID_UMASK = 3; //invalid unit mask value
+ public static final int INVALID_COUNTER = 4; //invalid event for given counter number
+
+ private static final String _RESULT_TAG = "result"; //$NON-NLS-1$
+ private static final String _CHECK_EVENTS_TAG ="check-events"; //$NON-NLS-1$
+
+ private static final String _EVENT_OK = "ok"; //$NON-NLS-1$
+ private static final String _INVALID_EVENT = "invalid-event"; //$NON-NLS-1$
+ private static final String _INVALID_UMASK = "invalid-um"; //$NON-NLS-1$
+ private static final String _INVALID_COUNTER = "invalid-counter"; //$NON-NLS-1$
+
+ private int _result;
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#reset()
+ */
+ public void reset(Object callData) {
+ _result = INVALID_UNKNOWN;
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(_RESULT_TAG)) {
+ if (_characters.equals(_EVENT_OK)) {
+ _result = EVENT_OK;
+ } else if (_characters.equals(_INVALID_EVENT)) {
+ _result = INVALID_EVENT;
+ } else if (_characters.equals(_INVALID_UMASK)) {
+ _result = INVALID_UMASK;
+ } else if (_characters.equals(_INVALID_COUNTER)) {
+ _result = INVALID_COUNTER;
+ }
+ } else if (name.equals(_CHECK_EVENTS_TAG)) {
+ int[] result = (int[]) callData;
+ result[0] = _result;
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/DefaultsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/DefaultsProcessor.java
new file mode 100644
index 0000000000..817d842029
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/DefaultsProcessor.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.info;
+
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+
+/**
+ * XML handler class for opxml's "defaults".
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class DefaultsProcessor extends XMLProcessor {
+ // XML tags reconize by this processor (public)
+ public static final String SAMPLE_DIR = "sample-dir"; //$NON-NLS-1$
+ public static final String LOCK_FILE = "lock-file"; //$NON-NLS-1$
+ public static final String LOG_FILE = "log-file"; //$NON-NLS-1$
+ public static final String DUMP_STATUS = "dump-status"; //$NON-NLS-1$
+ protected HashMap<String,String> _map = new HashMap<String,String>();
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#reset()
+ */
+ public void reset(Object callData) {
+ _map.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor#endElement(java.lang.String, java.lang.Object)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(OpInfoProcessor.DEFAULTS_TAG)) {
+ OpInfo info = (OpInfo) callData;
+ info._setDefaults(_map);
+ OprofileSAXHandler.getInstance(callData).pop(name);
+ } else {
+ _map.put(name, _characters);
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/EventListProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/EventListProcessor.java
new file mode 100644
index 0000000000..72f5e7733f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/EventListProcessor.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2004,2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.info;
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+
+/**
+ * XML handler class for opxml's "event-list".
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class EventListProcessor extends XMLProcessor {
+ // The current event being constructed
+ private OpEvent _currentEvent;
+ private int _counter;
+ private ArrayList<OpEvent> _currentEventList;
+
+ // An XML processor for reading the unit mask information for an event
+ private UnitMaskProcessor _umProcessor;
+
+ // XML elements recognized by this processor
+ private static final String _EVENT_TAG = "event"; //$NON-NLS-1$
+ private static final String _UNIT_MASK_TAG = "unit-mask"; //$NON-NLS-1$
+ private static final String _NAME_TAG = "name"; //$NON-NLS-1$
+ private static final String _VALUE_TAG = "value"; //$NON-NLS-1$
+ private static final String _DESCRIPTION_TAG = "description"; //$NON-NLS-1$
+ private static final String _MASK_TAG = "mask"; //$NON-NLS-1$
+ private static final String _MINIMUM_COUNT_TAG = "minimum"; //$NON-NLS-1$
+ private static final String _ATTR_EVENT_LIST_COUNTER = "counter"; //$NON-NLS-1$
+
+ // This is a special processor which is used to deal with a single mask value
+ private class MaskProcessor extends XMLProcessor {
+ private OpUnitMask.MaskInfo _info;
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#reset()
+ */
+ public void reset(Object callData) {
+ _info = new OpUnitMask.MaskInfo();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(_VALUE_TAG)) {
+ // Set mask's value
+ _info.value = Integer.parseInt(_characters);
+ } else if (name.equals(_DESCRIPTION_TAG)) {
+ _info.description = _characters;
+ } else if (name.equals(_MASK_TAG)) {
+ // Pop and pass mask tag to previous processor (UnitMaskProcessor)
+ OprofileSAXHandler.getInstance(callData).pop(_MASK_TAG);
+ }
+ }
+
+ /**
+ * Returns the information that has been collected about a mask.
+ * @return the mask information
+ */
+ public OpUnitMask.MaskInfo getResult() {
+ return _info;
+ }
+ }
+
+ // This is a special processor to handle unit mask information
+ private class UnitMaskProcessor extends XMLProcessor {
+ // An ArrayList to hold all the valid masks for a unit mask.
+ private ArrayList<OpUnitMask.MaskInfo> _masks;
+
+ // The unit mask being constructed
+ private OpUnitMask _unitMask;
+
+ // An XML processor for each individual mask value.
+ private MaskProcessor _maskProcessor;
+
+ // XML elements recognized by this processor
+ private static final String _MASK_TYPE_TAG = "type"; //$NON-NLS-1$
+ private static final String _MASK_DEFAULT_TAG = "default"; //$NON-NLS-1$
+ private static final String _MASK_TYPE_BITMASK = "bitmask"; //$NON-NLS-1$
+ private static final String _MASK_TYPE_MANDATORY = "mandatory"; //$NON-NLS-1$
+ private static final String _MASK_TYPE_EXCLUSIVE = "exclusive"; //$NON-NLS-1$
+
+ /**
+ * Constructor for UnitMaskProcessor. Initializes internal state.
+ */
+ public UnitMaskProcessor() {
+ super();
+ _maskProcessor = new MaskProcessor();
+ _masks = new ArrayList<OpUnitMask.MaskInfo>();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#reset()
+ */
+ public void reset(Object callData) {
+ _unitMask = new OpUnitMask();
+ _masks.clear();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#startElement(String, Attributes)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(_MASK_TAG)) {
+ // Tell SAX handler to use the mask processor
+ OprofileSAXHandler.getInstance(callData).push(_maskProcessor);
+ } else {
+ super.startElement(name, attrs, callData);
+ }
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(_MASK_TYPE_TAG)) {
+ // Set the mask type
+ _unitMask._setType(_getTypeFromString(_characters));
+ } else if (name.equals(_MASK_DEFAULT_TAG)) {
+ // Set the default mask
+ _unitMask._setDefault(Integer.parseInt(_characters));
+ } else if (name.equals(_MASK_TAG)) {
+ // Add this mask description to the list of all masks
+ _masks.add(_maskProcessor.getResult());
+ } else if (name.equals(_UNIT_MASK_TAG)) {
+ // All done. Add the known masks to the unit mask
+ OpUnitMask.MaskInfo[] descs = new OpUnitMask.MaskInfo[_masks.size()];
+ _masks.toArray(descs);
+ _unitMask._setMaskDescriptions(descs);
+
+ // Pop this processor and pass _UNIT_MASK_TAG to previoius processor
+ OprofileSAXHandler.getInstance(callData).pop(_UNIT_MASK_TAG);
+ }
+ }
+
+ /**
+ * Returns the constructed unit mask.
+ * @return the unit mask
+ */
+ public OpUnitMask getResult() {
+ return _unitMask;
+ }
+
+ // Converts a string representing a mask type into an integer
+ private int _getTypeFromString(String string) {
+ if (string.equals(_MASK_TYPE_MANDATORY)) {
+ return OpUnitMask.MANDATORY;
+ } else if (string.equals(_MASK_TYPE_BITMASK)) {
+ return OpUnitMask.BITMASK;
+ } else if (string.equals(_MASK_TYPE_EXCLUSIVE)) {
+ return OpUnitMask.EXCLUSIVE;
+ }
+
+ return -1;
+ }
+ };
+
+ /**
+ * Constructor for EventListProcessor. Initializes internal state.
+ */
+ public EventListProcessor() {
+ super();
+ _umProcessor = new UnitMaskProcessor();
+ }
+
+ @Override
+ public void reset(Object callData) {
+ _currentEventList = new ArrayList<OpEvent>();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#startElement(String, Attributes)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(_EVENT_TAG)) {
+ // new event
+ _currentEvent = new OpEvent();
+ } else if (name.equals(_UNIT_MASK_TAG)) {
+ // Tell the SAX handler to use the unit mask processor
+ OprofileSAXHandler.getInstance(callData).push(_umProcessor);
+ } else if (name.equals(OpInfoProcessor.EVENT_LIST_TAG)) {
+ // Our start tag: grab the counter number from the attributes
+ _counter = Integer.parseInt(attrs.getValue(_ATTR_EVENT_LIST_COUNTER));
+ } else {
+ super.startElement(name, attrs, callData);
+ }
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(_EVENT_TAG)) {
+ // Finished constructing an event. Add it to the list.
+ _currentEventList.add(_currentEvent);
+ } else if (name.equals(_UNIT_MASK_TAG)) {
+ // Set the event's unit mask
+ _currentEvent._setUnitMask(_umProcessor.getResult());
+ } else if (name.equals(_NAME_TAG)) {
+ // Set event's name
+ _currentEvent._setText(_characters);
+ } else if (name.equals(_VALUE_TAG)) {
+ // Set event's value
+ _currentEvent._setNumber(Integer.parseInt(_characters));
+ } else if (name.equals(_DESCRIPTION_TAG)) {
+ // Set event's description
+ _currentEvent._setTextDescription(_characters);
+ } else if (name.equals(_MINIMUM_COUNT_TAG)) {
+ // Set event's minimum count
+ _currentEvent._setMinCount(Integer.parseInt(_characters));
+ } else if (name.equals(OpInfoProcessor.EVENT_LIST_TAG)) {
+ OprofileSAXHandler.getInstance(callData).pop(name);
+ }
+ }
+
+ public int getCounterNum() {
+ return _counter;
+ }
+
+ public OpEvent[] getEvents() {
+ OpEvent[] events = new OpEvent[_currentEventList.size()];
+ _currentEventList.toArray(events);
+ return events;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java
new file mode 100644
index 0000000000..ef0b8ea24c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/info/OpInfoProcessor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004,2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.info;
+
+import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+
+/**
+ * Opxml processor for the "info" command.
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class OpInfoProcessor extends XMLProcessor {
+ // Other XMLProcessors used by this processor
+ private DefaultsProcessor _defaultsProc;
+ private EventListProcessor _eventListProc;
+
+ // XML tags processed by this processor
+ public static final String NUM_COUNTERS_TAG = "num-counters"; //$NON-NLS-1$
+ public static final String DEFAULTS_TAG = "defaults"; //$NON-NLS-1$
+ public static final String EVENT_LIST_TAG = "event-list"; //$NON-NLS-1$
+ public static final String CPU_FREQUENCY_TAG = "cpu-frequency"; //$NON-NLS-1$
+ public static final String TIMER_MODE = "timer-mode"; //$NON-NLS-1$
+
+ public OpInfoProcessor() {
+ _defaultsProc = new DefaultsProcessor();
+ _eventListProc = new EventListProcessor();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor#startElement(java.lang.String, org.xml.sax.Attributes, java.lang.Object)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(DEFAULTS_TAG)) {
+ OprofileSAXHandler.getInstance(callData).push(_defaultsProc);
+ } else if (name.equals(EVENT_LIST_TAG)) {
+ OprofileSAXHandler.getInstance(callData).push(_eventListProc);
+ _eventListProc.startElement(name, attrs, callData);
+ } else {
+ super.startElement(name, attrs, callData);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor#endElement(java.lang.String, java.lang.Object)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(CPU_FREQUENCY_TAG)) {
+ double speed = Double.parseDouble(_characters);
+ OpInfo info = (OpInfo) callData;
+ info._setCPUSpeed(speed);
+ } else if (name.equals(TIMER_MODE)) {
+ boolean timerMode = Boolean.parseBoolean(_characters);
+ OpInfo info = (OpInfo) callData;
+ info._setTimerMode(timerMode);
+ } else if (name.equals(NUM_COUNTERS_TAG)) {
+ int numCounters = 0;
+ try {
+ numCounters = Integer.parseInt(_characters);
+ } catch (NumberFormatException nfe) {
+ }
+ OpInfo info = (OpInfo) callData;
+ info._setNrCounters(numCounters);
+ } else if (name.equals(EVENT_LIST_TAG)) {
+ OpInfo info = (OpInfo) callData;
+ info._setEvents(_eventListProc.getCounterNum(), _eventListProc.getEvents());
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/DependentProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/DependentProcessor.java
new file mode 100644
index 0000000000..44b4149134
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/DependentProcessor.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.modeldata;
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+
+/**
+ * XML handler class for dependent images (<image> tags under <dependent>)
+ */
+public class DependentProcessor extends XMLProcessor {
+ //XML tags parsed by this processor
+ private static final String IMAGE_TAG = "image"; //$NON-NLS-1$
+ private static final String SYMBOLS_TAG = "symbols"; //$NON-NLS-1$
+ private static final String DEPENDENT_TAG = "dependent"; //$NON-NLS-1$
+
+ //attribute tags
+ private static final String ATTR_IMAGENAME = "name"; //$NON-NLS-1$
+ private static final String ATTR_COUNT = "count"; //$NON-NLS-1$
+
+ //the current image being constructed
+ private OpModelImage _image;
+ //a list of all the dependent images
+ private ArrayList<OpModelImage> _imageList;
+
+ //processor used for symbols of an image
+ private SymbolsProcessor _symbolsProcessor = new SymbolsProcessor();
+
+ public void reset(Object callData) {
+ _image = new OpModelImage();
+ _imageList = new ArrayList<OpModelImage>();
+ }
+
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(IMAGE_TAG)) {
+ _image._setName(valid_string(attrs.getValue(ATTR_IMAGENAME)));
+ _image._setCount(Integer.parseInt(attrs.getValue(ATTR_COUNT)));
+ } else if (name.equals(SYMBOLS_TAG)) {
+ OprofileSAXHandler.getInstance(callData).push(_symbolsProcessor);
+ }
+ }
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(IMAGE_TAG)) {
+ _imageList.add(_image);
+ _image = new OpModelImage();
+ } else if (name.equals(SYMBOLS_TAG)) {
+ _image._setSymbols(_symbolsProcessor.getSymbols());
+ } else if (name.equals(DEPENDENT_TAG)) {
+ OprofileSAXHandler.getInstance(callData).pop(DEPENDENT_TAG);
+ }
+ }
+
+ public OpModelImage[] getImages() {
+ OpModelImage[] images = new OpModelImage[_imageList.size()];
+ _imageList.toArray(images);
+ return images;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/ModelDataProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/ModelDataProcessor.java
new file mode 100644
index 0000000000..c625f44708
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/ModelDataProcessor.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.core.opxml.modeldata;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+
+/**
+ * A processor for `opxml samples`.
+ */
+public class ModelDataProcessor extends XMLProcessor {
+ //The resulting image compiled by the processor to be used by the caller.
+ public static class CallData {
+ public OpModelImage image;
+ public CallData(OpModelImage im) { image = im; }
+ }
+
+ //XML tags parsed by this processor
+ private static final String IMAGE_TAG = "image"; //$NON-NLS-1$
+ private static final String SYMBOLS_TAG = "symbols"; //$NON-NLS-1$
+ private static final String DEPENDENT_TAG = "dependent"; //$NON-NLS-1$
+
+ //attribute tags
+ private static final String ATTR_IMAGENAME = "name"; //$NON-NLS-1$
+ private static final String ATTR_COUNT = "count"; //$NON-NLS-1$
+ private static final String ATTR_DEPCOUNT = "count"; //$NON-NLS-1$
+
+ //the current image being constructed
+ private OpModelImage _image;
+ private int img_seen; //for ensuring image singleton-ness
+
+ //processors used for symbols and dependent images
+ private SymbolsProcessor _symbolsProcessor = new SymbolsProcessor();
+ private DependentProcessor _dependentProcessor = new DependentProcessor();
+
+
+ public void reset(Object callData) {
+ _image = ((CallData) callData).image;
+ img_seen = 0;
+ }
+
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(IMAGE_TAG)) {
+ if (img_seen == 0) {
+ _image._setName(valid_string(attrs.getValue(ATTR_IMAGENAME)));
+ _image._setCount(Integer.parseInt(attrs.getValue(ATTR_COUNT)));
+ }
+
+ img_seen++;
+ } else if (name.equals(SYMBOLS_TAG)) {
+ OprofileSAXHandler.getInstance(callData).push(_symbolsProcessor);
+ } else if (name.equals(DEPENDENT_TAG)) {
+ _image._setDepCount(Integer.parseInt(attrs.getValue(ATTR_DEPCOUNT)));
+ OprofileSAXHandler.getInstance(callData).push(_dependentProcessor);
+ } else {
+ super.startElement(name, attrs, callData);
+ }
+ }
+
+ public void endElement(String name, Object callData) {
+ if (name.equals(IMAGE_TAG)) {
+ if (img_seen > 1) {
+ //should only ever be one image, otherwise oprofile was run
+ // outside of eclipse and the ui would not handle it properly
+ _image._setCount(OpModelImage.IMAGE_PARSE_ERROR);
+ _image._setDepCount(0);
+ _image._setDependents(null);
+ _image._setSymbols(null);
+ _image._setName(""); //$NON-NLS-1$
+ }
+ } else if (name.equals(SYMBOLS_TAG)){
+ _image._setSymbols(_symbolsProcessor.getSymbols());
+ } else if (name.equals(DEPENDENT_TAG)){
+ _image._setDependents(_dependentProcessor.getImages());
+ } else {
+ super.endElement(name, callData);
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SamplesProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SamplesProcessor.java
new file mode 100644
index 0000000000..253c50b9fb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SamplesProcessor.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ * - Note: the original SamplesProcessor class was removed, this is a new
+ * implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.modeldata;
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSample;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+
+
+/**
+ * XML handler class for <sample> tags (individual samples).
+ */
+public class SamplesProcessor extends XMLProcessor {
+ //XML tags parsed by this processor
+ private static final String SAMPLE_TAG = "sample"; //$NON-NLS-1$
+ private static final String COUNT_TAG = "count"; //$NON-NLS-1$
+ private static final String LINE_TAG = "line"; //$NON-NLS-1$
+ private static final String SYMBOL_TAG = "symbol"; //$NON-NLS-1$
+
+ //the current sample being constructed
+ private OpModelSample _sample;
+ //a list of all samples (for this symbol)
+ private ArrayList<OpModelSample> _sampleList;
+
+ public void reset(Object callData) {
+ _sample = new OpModelSample();
+ _sampleList = new ArrayList<OpModelSample>();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(COUNT_TAG)) {
+ _sample._setCount(Integer.parseInt(_characters));
+ } else if (name.equals(LINE_TAG)) {
+ _sample._setLine(Integer.parseInt(_characters));
+ } else if (name.equals(SAMPLE_TAG)) {
+ _sampleList.add(_sample);
+ _sample = new OpModelSample();
+ } else if (name.equals(SYMBOL_TAG)) {
+ OprofileSAXHandler.getInstance(callData).pop(SYMBOL_TAG);
+ }
+ }
+
+ public OpModelSample[] getSamples() {
+ OpModelSample[] samples = new OpModelSample[_sampleList.size()];
+ _sampleList.toArray(samples);
+ return samples;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SymbolsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SymbolsProcessor.java
new file mode 100644
index 0000000000..353f3e7193
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/modeldata/SymbolsProcessor.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.modeldata;
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSymbol;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+/**
+ * A processor for the <symbols> tag from `opxml samples ..`
+ */
+public class SymbolsProcessor extends XMLProcessor {
+ //XML tags parsed by this processor
+ private static final String SYMBOLS_TAG = "symbols"; //$NON-NLS-1$
+ private static final String SYMBOL_TAG = "symbol"; //$NON-NLS-1$
+ private static final String SAMPLE_TAG = "sample"; //$NON-NLS-1$
+
+ //attribute tags
+ private static final String ATTR_NAME = "name"; //$NON-NLS-1$
+ private static final String ATTR_FILE = "file"; //$NON-NLS-1$
+ private static final String ATTR_COUNT = "count"; //$NON-NLS-1$
+
+ //the current symbol being constructed
+ private OpModelSymbol _symbol;
+ //all the symbols in this <symbols> tag, to be returned to the calling ModelDataProcessor
+ private ArrayList<OpModelSymbol> _symbols;
+
+ //the processor used for individual samples
+ private SamplesProcessor _samplesProcessor = new SamplesProcessor();
+
+
+ public void reset(Object callData) {
+ _symbol = new OpModelSymbol();
+ _symbols = new ArrayList<OpModelSymbol>();
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#startElement(String, Attributes)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(SYMBOL_TAG)) {
+ _symbol._setName(valid_string(attrs.getValue(ATTR_NAME)));
+ _symbol._setCount(Integer.parseInt(attrs.getValue(ATTR_COUNT)));
+ _symbol._setFile(valid_string(attrs.getValue(ATTR_FILE)));
+ } else if (name.equals(SAMPLE_TAG)) {
+ OprofileSAXHandler.getInstance(callData).push(_samplesProcessor);
+ }
+ }
+
+ /**
+ * @see org.eclipse.linuxtools.oprofile.core.XMLProcessor#endElement(String)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(SYMBOL_TAG)) {
+ _symbol._setSamples(_samplesProcessor.getSamples());
+ _symbols.add(_symbol);
+ _symbol = new OpModelSymbol();
+ } else if (name.equals(SYMBOLS_TAG)) {
+ OprofileSAXHandler.getInstance(callData).pop(SYMBOLS_TAG);
+ }
+ }
+
+ //return all parsed samples
+ public OpModelSymbol[] getSymbols() {
+ OpModelSymbol [] symbols = new OpModelSymbol[_symbols.size()];
+ _symbols.toArray(symbols);
+ return symbols;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/sessions/SessionsProcessor.java b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/sessions/SessionsProcessor.java
new file mode 100644
index 0000000000..a8144bd04e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/opxml/sessions/SessionsProcessor.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.core.opxml.sessions;
+
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
+import org.xml.sax.Attributes;
+
+
+/**
+ * A processor for sessions.
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.OpxmlRunner
+ */
+public class SessionsProcessor extends XMLProcessor {
+ public static class SessionInfo {
+ // A list of SessionEvents
+ public ArrayList<OpModelEvent> list;
+
+ public SessionInfo(ArrayList<OpModelEvent> _list){
+ list = _list;
+ }
+ };
+
+ // XML tags recognized by this processor
+ public static final String SESSION_TAG = "session"; //$NON-NLS-1$
+ private static final String _SESSION_NAME_ATTR = "name"; //$NON-NLS-1$
+ public static final String SAMPLE_COUNT_TAG = "count"; //$NON-NLS-1$
+ public static final String EVENT_TAG = "event"; //$NON-NLS-1$
+ private static final String _EVENT_NAME_ATTR = "name"; //$NON-NLS-1$
+
+ // The current session being constructed
+ private OpModelSession _currentSession;
+
+ // The current event being constructed
+ private OpModelEvent _currentEvent;
+
+ // A list of all sessions
+ private ArrayList<OpModelSession> _sessionList;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor#startElement(java.lang.String, org.xml.sax.Attributes, java.lang.Object)
+ */
+ public void startElement(String name, Attributes attrs, Object callData) {
+ if (name.equals(SESSION_TAG)) {
+ String sessionName = valid_string(attrs.getValue(_SESSION_NAME_ATTR));
+ _currentSession = new OpModelSession(_currentEvent, sessionName);
+ } else if (name.equals(EVENT_TAG)) {
+ String eventName = attrs.getValue(_EVENT_NAME_ATTR);
+ _currentEvent = new OpModelEvent(eventName);
+ _sessionList = new ArrayList<OpModelSession>();
+ } else {
+ super.startElement(name, attrs, callData);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor#endElement(java.lang.String, java.lang.Object)
+ */
+ public void endElement(String name, Object callData) {
+ if (name.equals(SESSION_TAG)) {
+ // Got end of session -- save in session list
+ _sessionList.add(_currentSession);
+ _currentSession = null;
+ } else if (name.equals(EVENT_TAG)) {
+ // Got end of event -- save session list into current OpModelEvent and
+ // save current event into call data
+ OpModelSession[] s = new OpModelSession[_sessionList.size()];
+ _sessionList.toArray(s);
+ _currentEvent._setSessions(s);
+ SessionInfo info = (SessionInfo) callData;
+ info.list.add(_currentEvent);
+ _currentEvent = null;
+ _sessionList = null;
+ } else {
+ super.endElement(name, callData);
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.doc/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/.project b/oprofile/org.eclipse.linuxtools.oprofile.doc/.project
new file mode 100644
index 0000000000..9df5409881
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.doc</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.doc/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..0d476152af
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Tue Apr 14 09:48:05 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/ChangeLog b/oprofile/org.eclipse.linuxtools.oprofile.doc/ChangeLog
new file mode 100644
index 0000000000..e817cabf7c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/ChangeLog
@@ -0,0 +1,44 @@
+2009-04-15 Andrew Overholt <overholt@redhat.com>
+
+ * doc/notices.html: Use copyright symbol.
+
+2009-04-15 Andrew Overholt <overholt@redhat.com>
+
+ * build-helper.xml: Add comment about checking WikiText out into your workspace.
+
+2009-04-14 Andrew Overholt <overholt@redhat.com>
+
+ * build-helper.xml: Get rid of Phoenix extension (to have common side navigation
+ bar) in resulting HTML.
+
+2009-04-14 Andrew Overholt <overholt@redhat.com>
+
+ * userguide/OProfile Reference.html: Newly-generated to include image.
+ * userguide/images/LinuxTools-0.2.0-OProfile-Screenshot.png: Initial checkin.
+
+2009-04-14 Andrew Overholt <overholt@redhat.com>
+
+ * META-INF/MANIFEST.MF: Add .qualifier. Set bundle localization.
+ * plugin.xml: Set id on toc extension. Add generated toc.
+ * toc.xml: Get rid of extraneous stuff. We can re-add if we feel we need it.
+
+2009-04-14 Andrew Overholt <overholt@redhat.com>
+
+ * about.html: Initial checkin.
+ * build-helper.xml: Likewise.
+ * build.properties: Likewise.
+ * ChangeLog: Likewise.
+ * .classpath: Likewise.
+ * doc/notices.html: Likewise.
+ * extract-markup.xsl: Likewise.
+ * META-INF/MANIFEST.MF: Likewise.
+ * plugin.properties: Likewise.
+ * plugin.xml: Likewise.
+ * .project: Likewise.
+ * .settings/org.eclipse.jdt.core.prefs: Likewise.
+ * src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/MediaWikiImageFetcher.java: Likewise.
+ * src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties: Likewise.
+ * toc.xml: Likewise.
+ * userguide/OProfile Reference.html: Likewise.
+ * userguide/OProfile Reference-toc.xml: Likewise.
+ * userguide/Updating-This-Document.html: Likewise. \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.doc/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..95e77eb970
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.doc; singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.apache.ant;bundle-version="1.7.0";resolution:=optional,
+ org.eclipse.help
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/about.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/build-helper.xml b/oprofile/org.eclipse.linuxtools.oprofile.doc/build-helper.xml
new file mode 100644
index 0000000000..1da04de45d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/build-helper.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.eclipse.linuxtools.oprofile.doc" default="all">
+ <description>
+ Generate Eclipse help content for the Linux Tools OProfile user guide
+ </description>
+
+ <property name="oprofile.help.doc.url.base" value="http://wiki.eclipse.org"/>
+ <property name="oprofile.wiki.url.base" value="${oprofile.help.doc.url.base}/Linux_Tools_Project/OProfile"/>
+ <property name="imageFolder" value="images"/>
+
+ <path id="tasks.classpath" path="bin"/>
+
+ <!-- See the paths below?
+ Check org.eclipse.mylyn.wikitext.{core,mediawiki.core} into your workspace
+ from Mylyn CVS (under tools project in eclipse.org CVS)
+ -->
+
+ <path id="wikitext.tasks.classpath">
+ <pathelement location="../org.eclipse.mylyn.wikitext.core/@dot"/>
+ <pathelement location="../org.eclipse.mylyn.wikitext.core/bin"/>
+ <pathelement location="../org.eclipse.mylyn.wikitext.mediawiki.core/@dot"/>
+ <pathelement location="../org.eclipse.mylyn.wikitext.mediawiki.core/bin"/>
+ </path>
+
+ <taskdef classpathref="tasks.classpath" resource="org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties"/>
+ <taskdef classpathref="wikitext.tasks.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties"/>
+
+ <target name="init">
+ <mkdir dir="tmp"/>
+ </target>
+
+ <target name="clean" depends="init">
+ <delete includeemptydirs="true" failonerror="false">
+ <fileset dir="tmp"/>
+ </delete>
+ </target>
+
+ <target name="all" depends="init" description="Generate Eclipse help content for the Linux Tools OProfile user guide">
+ <eclipse-wiki-to-help
+ help.doc.filenamenoextension="OProfile Reference"
+ help.doc.url.base="${oprofile.help.doc.url.base}"
+ help.doc.url.html="${oprofile.wiki.url.base}/User_Guide"
+ help.doc.url.xml="${oprofile.help.doc.url.base}/Special:Export/Linux_Tools_Project/OProfile/User_Guide"
+ help.imagefolder="${imageFolder}"
+ targetfolder="userguide"
+ wiki.url.base="${oprofile.help.doc.url.base}/Linux_Tools_Project"/>
+ </target>
+
+ <macrodef name="eclipse-wiki-to-help">
+ <attribute name="help.doc.url.base"/>
+ <attribute name="wiki.url.base"/>
+ <attribute name="help.doc.url.html"/>
+ <attribute name="help.doc.url.xml"/>
+ <attribute name="help.doc.filenameNoExtension"/>
+ <attribute name="help.imageFolder"/>
+ <attribute name="targetFolder"/>
+ <sequential>
+ <get dest="tmp/help.doc.xml" src="@{help.doc.url.xml}"/>
+ <get dest="tmp/help.doc.html" src="@{help.doc.url.html}"/>
+
+ <!--
+ <copy todir="tmp">
+ <fileset dir="images"/>
+ </copy>
+ -->
+ <mediawiki-fetch-images src="tmp/help.doc.html" dest="tmp" base="@{help.doc.url.base}"/>
+
+ <xslt style="extract-markup.xsl" in="tmp/help.doc.xml" out="tmp/@{help.doc.filenameNoExtension}.mediawiki"/>
+ <echo append="true" file="tmp/@{help.doc.filenameNoExtension}.mediawiki">
+
+= Updating This Document =
+
+This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
+@{help.doc.url.html}
+ </echo>
+
+ <!-- Removing Phoenix extensions -->
+ <replaceregexp match="\{\{\#eclipseproject.*" replace="" flags="g" byline="true">
+ <fileset dir="tmp" includes="**/*.mediawiki"/>
+ </replaceregexp>
+
+ <wikitext-to-eclipse-help markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
+ multipleOutputFiles="true"
+ navigationImages="true"
+ helpPrefix="@{targetFolder}"
+ internallinkpattern="@{wiki.url.base}/{0}"
+ validate="true"
+ failonvalidationerror="true"
+ prependImagePrefix="${imageFolder}"
+ formatoutput="true">
+ <fileset dir="tmp" includes="**/*.mediawiki"/>
+ <stylesheet url="book.css"/>
+ </wikitext-to-eclipse-help>
+
+ <wikitext-to-docbook markupLanguage="org.eclipse.mylyn.wikitext.mediawiki.core.MediaWikiLanguage"
+ internallinkpattern="@{wiki.url.base}/{0}"
+ validate="true"
+ failonvalidationerror="true"
+ overwrite="true">
+ <fileset dir="tmp" includes="**/*.mediawiki"/>
+ </wikitext-to-docbook>
+
+ <mkdir dir="@{targetFolder}/${imageFolder}"/>
+ <copy todir="@{targetFolder}/${imageFolder}" overwrite="true">
+ <fileset dir="tmp">
+ <include name="*.gif"/>
+ <include name="*.png"/>
+ </fileset>
+ </copy>
+ <copy todir="@{targetFolder}" overwrite="true">
+ <fileset dir="tmp">
+ <include name="*.html"/>
+ <include name="*.xml"/>
+ <exclude name="help.doc.html"/>
+ <exclude name="help.doc.xml"/>
+ </fileset>
+ </copy>
+ <antcall target="test"/>
+ </sequential>
+ </macrodef>
+
+
+ <target name="test" depends="init" description="verify that all of the HTML files are well-formed XML">
+ <echo level="info">
+Validating help content XML and HTML files: The Eclipse help system expects well-formed XML
+
+If validation fails it is because either:
+
+* the userguide source code is poorly formed, or
+* the WikiText MediaWiki parser has a bug
+
+Problems with userguide source are usually caused by improper use of HTML markup in the MediaWiki source,
+or inadvertently starting a line with a space character (in MediaWiki this starts a preformatted block)
+ </echo>
+
+ <!--
+ Don't bother with DTD validation: we only care if the files are well-formed.
+ We therefore provide an empty DTD
+ -->
+ <echo file="tmp/__empty.dtd" message=""/>
+ <xmlvalidate lenient="true">
+ <fileset dir="userguide">
+ <include name="**/*.xml"/>
+ </fileset>
+ <fileset dir="userguide">
+ <include name="**/*.html"/>
+ </fileset>
+ <dtd publicid="-//W3C//DTD XHTML 1.0 Transitional//EN" location="${basedir}/tmp/__empty.dtd"/>
+ </xmlvalidate>
+ </target>
+</project>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.doc/build.properties
new file mode 100644
index 0000000000..bcf97c034e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/build.properties
@@ -0,0 +1,19 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ doc/,\
+ userguide/,\
+ toc.xml,\
+ plugin.properties,\
+ about.html
+src.includes = userguide/,\
+ toc.xml,\
+ src/,\
+ plugin.xml,\
+ plugin.properties,\
+ doc/,\
+ about.html,\
+ META-INF/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/doc/notices.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/doc/notices.html
new file mode 100644
index 0000000000..dd6688fd29
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/doc/notices.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+
+<meta name="copyright" content="&#169; Copyright 2009 Eclipse Linux Tools project committers and others. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
+
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <LINK REL="STYLESHEET" HREF="book.css" CHARSET="ISO-8859-1" TYPE="text/css">
+ <title>Legal Notices</title>
+</head>
+<body>
+
+<h3>
+<a NAME="Notices"></a>Notices</h3>
+<p>
+The material in this guide is &#169; Copyright 2009 Eclipse Linux Tools project committers and others.
+</p>
+<p>
+<a href="../about.html">Terms and conditions regarding the use of this guide.</a>
+</p>
+</body>
+</html>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/extract-markup.xsl b/oprofile/org.eclipse.linuxtools.oprofile.doc/extract-markup.xsl
new file mode 100644
index 0000000000..4c4e731948
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/extract-markup.xsl
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:mw="http://www.mediawiki.org/xml/export-0.3/">
+ <xsl:output method="text"/>
+
+ <xsl:template match="/">
+ <xsl:value-of select="//mw:text"/>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.properties
new file mode 100644
index 0000000000..b95f8f4937
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.properties
@@ -0,0 +1,2 @@
+Bundle-Vendor = Eclipse Linux Tools
+Bundle-Name = OProfile Documentation (Incubation) \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.xml b/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.xml
new file mode 100644
index 0000000000..0c609f8d66
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ id="org.eclipse.linuxtools.oprofile.doc.helpDocs"
+ name="OProfile"
+ point="org.eclipse.help.toc">
+ <toc
+ file="toc.xml"
+ primary="true">
+ </toc>
+ <toc
+ file="userguide/OProfile Reference-toc.xml"
+ primary="false">
+ </toc>
+ </extension>
+
+</plugin>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/MediaWikiImageFetcher.java b/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/MediaWikiImageFetcher.java
new file mode 100644
index 0000000000..f6dc9950c4
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/MediaWikiImageFetcher.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 David Green and others.
+ * 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:
+ * David Green - initial API and implementation
+ *
+ * Re-namespaced 2009-04-14 without changes from org.eclipse.mylyn.help.ui.
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.oprofile.doc.anttask;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Get;
+
+/**
+ * Fetch images from a MediaWiki-generated HTML page source
+ *
+ * @author David Green
+ */
+public class MediaWikiImageFetcher extends Task {
+
+ private String base;
+
+ private File dest;
+
+ private File src;
+
+ @Override
+ public void execute() throws BuildException {
+ if (dest == null) {
+ throw new BuildException("Must specify @dest"); //$NON-NLS-1$
+ }
+ if (!dest.exists()) {
+ throw new BuildException("@dest does not exist: " + dest); //$NON-NLS-1$
+ }
+ if (!dest.isDirectory()) {
+ throw new BuildException("@dest is not a directory: " + dest); //$NON-NLS-1$
+ }
+ if (src == null) {
+ throw new BuildException("Must specify @src"); //$NON-NLS-1$
+ }
+ if (!src.exists()) {
+ throw new BuildException("@src does not exist: " + src); //$NON-NLS-1$
+ }
+ if (!src.isFile()) {
+ throw new BuildException("@src is not a file: " + src); //$NON-NLS-1$
+ }
+ if (base == null) {
+ throw new BuildException("Must specify @base"); //$NON-NLS-1$
+ }
+ if (base.endsWith("/")) { //$NON-NLS-1$
+ base = base.substring(0, base.length() - 1);
+ }
+ Pattern fragmentUrlPattern = Pattern.compile("src=\"([^\"]+)\""); //$NON-NLS-1$
+ Pattern imagePattern = Pattern.compile("alt=\"Image:([^\"]*)\"([^>]+)", Pattern.MULTILINE); //$NON-NLS-1$
+ String htmlSrc;
+ try {
+ htmlSrc = readSrc();
+ } catch (IOException e) {
+ throw new BuildException("Cannot read src: " + src + ": " + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ log("Parsing " + src, Project.MSG_INFO); //$NON-NLS-1$
+ int fileCount = 0;
+ Matcher imagePatternMatcher = imagePattern.matcher(htmlSrc);
+ while (imagePatternMatcher.find()) {
+ String alt = imagePatternMatcher.group(1);
+ String imageFragment = imagePatternMatcher.group(2);
+ if (imageFragment != null) {
+ Matcher fragmentUrlMatcher = fragmentUrlPattern.matcher(imageFragment);
+ if (fragmentUrlMatcher.find()) {
+ String url = fragmentUrlMatcher.group(1);
+ String qualifiedUrl = base + url;
+ log("Fetching " + qualifiedUrl, Project.MSG_INFO); //$NON-NLS-1$
+ Get get = new Get();
+ get.setProject(getProject());
+ get.setLocation(getLocation());
+ try {
+ get.setSrc(new URL(qualifiedUrl));
+ } catch (MalformedURLException e) {
+ log("Skipping " + url + ": " + e.getMessage(), Project.MSG_WARN); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
+ }
+ // note: we use the alt text for the name since for some files there is a case-difference between
+ // the server URL and the text used in the image src of the markup
+ String name = alt == null ? url.substring(url.lastIndexOf('/')) : alt;
+ get.setDest(new File(dest, name));
+ get.execute();
+ ++fileCount;
+ }
+ }
+ }
+ log("Fetched " + fileCount + " image files for " + src, Project.MSG_INFO); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public String getBase() {
+ return base;
+ }
+
+ public File getDest() {
+ return dest;
+ }
+
+ public File getSrc() {
+ return src;
+ }
+
+ private String readSrc() throws IOException {
+ StringBuilder buf = new StringBuilder((int) src.length());
+ Reader reader = new BufferedReader(new FileReader(src));
+ try {
+ int i;
+ while ((i = reader.read()) != -1) {
+ buf.append((char) i);
+ }
+ } finally {
+ reader.close();
+ }
+ return buf.toString();
+ }
+
+ public void setBase(String base) {
+ this.base = base;
+ }
+
+ public void setDest(File dest) {
+ this.dest = dest;
+ }
+
+ public void setSrc(File src) {
+ this.src = src;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties b/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties
new file mode 100644
index 0000000000..68f71a235e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/src/org/eclipse/linuxtools/internal/oprofile/doc/anttask/tasks.properties
@@ -0,0 +1 @@
+mediawiki-fetch-images=org.eclipse.linuxtools.internal.oprofile.doc.anttask.MediaWikiImageFetcher
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/toc.xml b/oprofile/org.eclipse.linuxtools.oprofile.doc/toc.xml
new file mode 100644
index 0000000000..0592fce6be
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/toc.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="OProfile Integration User Guide">
+ <link toc="userguide/OProfile Reference-toc.xml"/>
+ <topic href="doc/notices.html" label="Legal" />
+</toc> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Example-Project.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Example-Project.html
new file mode 100644
index 0000000000..d6f0855607
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Example-Project.html
@@ -0,0 +1,63 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Example Project</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Example Project</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="OProfile-View.html" title="OProfile View">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Troubleshooting.html" title="Troubleshooting">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">OProfile View</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Troubleshooting</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Example_Project">Example Project</h1>
+ <p>If you wish to try the documented steps in this article with a test project, you can download the same sample project used to create the screenshots at the following link:</p>
+ <p>
+ <a href="http://wiki.eclipse.org/images/7/77/Eclipse-oprofile_testproj_factorial.zip">http://wiki.eclipse.org/images/7/77/Eclipse-oprofile_testproj_factorial.zip</a>
+ </p>
+ <p>To import the project into the Eclipse workspace, navigate to <u>File</u> > <u>Import</u> > <u>General</u> > <u>Existing Projects into Workspace</u>. Then, choose <u>Select archive file</u> and use the <u>Browse</u> button to point to the location of the sample project on your file system.</p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="OProfile-View.html" title="OProfile View">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="Troubleshooting.html" title="Troubleshooting">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">OProfile View</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Troubleshooting</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Installation-and-Set-Up.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Installation-and-Set-Up.html
new file mode 100644
index 0000000000..00d22b9547
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Installation-and-Set-Up.html
@@ -0,0 +1,156 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Installation and Set-Up</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Installation and Set-Up</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="OProfile Reference.html" title="Overview">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Launching-A-Profile.html" title="Launching A Profile">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Overview</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Launching A Profile</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Installation_and_Set-Up">Installation and Set-Up</h1>
+ <p>The easiest way to install the OProfile plug-in for Eclipse is through the
+ <b>''Software Updates and Add-ons '</b>' menu. For information on how to use this menu, refer to
+ <a href="http://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp#Installing_Updates_From_the_Linux_Tools_Update_Site">http://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp#Installing_Updates_From_the_Linux_Tools_Update_Site</a>.
+ </p>
+ <p>Unlike most Eclipse plug-ins, the OProfile plug-in requires some configuration after installation. Note that this configuration process takes only a few simple steps, and only needs to be done once.</p>
+ <p>After the plug-in is first installed, performing a profile run with OProfile will bring up a dialog similar to the following:</p>
+ <p>
+ <img border="0" src="images/Screenshot-installscript_error_dialog.png"/>
+ </p>
+ <p>As the dialog suggests, you must run the supplied install script; this script will allow the OProfile plug-in to perform OProfile tasks as root (since OProfile cannot be run as an unprivileged user). The steps below are the same as the dialog but described in more detail.</p>
+ <h2 id="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</h2>
+ <p>Open up a terminal and locate the
+ <i><code>natives/linux/scripts</code></i> subdirectory, which is found in the
+ <i><code>org.eclipse.linuxtools.oprofile.core</code></i> plug-in directory. The location of this plug-in directory depends on how you installed Eclipse.
+ </p>
+ <ul>
+ <li>If you are using a distro-supplied version of Eclipse and installed the plug-in via the update site, the plug-in directory will most likely be under
+ <i><code>~/.eclipse</code></i>. To find the exact location of the plug-in directory in this case, use the following command:
+ <dl>
+ <dd><code>find ~/.eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'</code></dd>
+ </dl>
+ </li>
+ <li>Alternatively, if you are using an extracted tarball of Eclipse (i.e. you downloaded a
+ <i><code>.tar.gz</code></i> from
+ <a href="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</a>), then the plug-in will most likely be in the <code>plugins</code> sub-directory of where you extracted it.
+ <dl>
+ <dd>For example, if you extracted the tarball to <code>
+ <i>/home/ksebasti</i></code>, your Eclipse installation would be in <code>
+ <i>/home/ksebasti/eclipse</i></code>. In this case, you should use the following command to find the exact location of the plug-in directory:
+ </dd>
+ <dd><code>find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'</code></dd>
+ </dl>
+ </li>
+ </ul>
+ <p>
+ <b>Note:</b> In both cases, the quotes (') and asterisk (*) are necessary.
+ </p>
+ <p>Sample output will look like this:</p>
+ <pre>$ find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'
+/home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051
+</pre>
+ <p>Once you find the plug-in directory, navigate to its <code>
+ <i>natives/linux/scripts</i></code> subdirectory. Using our previous example:
+ <br/><code>cd /home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051/natives/linux/scripts</code>
+ </p>
+ <p>The <code>
+ <i>natives/linux/scripts</i></code> subdirectory contains the installation scripts you will need to run in order to allow OProfile to run as root.
+ </p>
+ <h2 id="Step_2_-_Choose_Which_Installation_Script_To_Run">Step 2 - Choose Which Installation Script To Run</h2>
+ <p>The
+ <i><code>natives/linux/scripts</code></i> subdirectory contains two scripts:
+ <i><code>install.sh</code></i> and
+ <i><code>install-noconsolehelper.sh</code></i>. Both scripts perform sanity checks to ensure OProfile is installed and that <code>opxml</code>, a C++ program required to interface with OProfile, exists and can be run. The difference is in how root authentication with the plug-in is set up.
+ </p>
+ <ul>
+ <li>
+ <i><code>install.sh</code></i> uses the pluggable authentication modules (PAM) mechanism. This is the default and recommended method for root authentication. When an OProfile task is required, you will be presented with this dialog to enter the root password:
+ <br/>
+ <img border="0" src="images/Screenshot-opcontrol_consolehelper.png"/>
+ </li>
+ <li>
+ <i><code>install-noconsolehelper.sh</code></i> can be used when <code>consolehelper</code> is not present on the system, or if required PAM modules are not on the system. It uses the sudo mechanism and a small wrapper script. The install script will describe the text which should be written in the
+ <i><code>sudoers</code></i> file, then run the command <code>visudo</code> to edit it.
+ <br/>'
+ <i>Warning:</i>' The
+ <i><code>sudoers</code></i> file is a sensitive system file and altering it in other ways may lead to system instability. Only users with enough knowledge of running a Linux system should use this method. For these reasons, this method of root authentication is discouraged. However, it may be the only option available to some users and it has been tested to work by developers and users of the plug-in.
+ </li>
+ </ul>
+ <h2 id="Step_3_-_Running_The_Install_Script">Step 3 - Running The Install Script</h2>
+ <p>Once you have selected an install script, log in as root. Assuming you are in the
+ <i><code>natives/linux/scripts</code></i> subdirectory of the plug-in directory (as in
+ <a href="Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</a>), run your selected install script:
+ </p>
+ <dl>
+ <dd><code>./install.sh</code></dd>
+ </dl>
+ <p>Successful output will look like this:</p>
+ <pre>./install.sh
+Eclipse-OProfile plugin install successful.
+</pre>
+ <p>Either install script should be run as the root user since both scripts perform some actions that require elevated privileges:
+ <i><code>install.sh</code></i> places files in
+ <i><code>/etc</code></i> subdirectories, while
+ <i><code>install-noconsolehelper.sh</code></i> runs the command <code>visudo</code>. If you wish to simply run either install script without logging in as root, use:
+ </p>
+ <dl>
+ <dd><code>su -c './install.sh'</code></dd>
+ </dl>
+ <p>This command will run only the install script as the root user, then return control to the regular user. Note that you will still need to enter the root password to make this work. If you receive an error message, refer to the
+ <a href="Troubleshooting.html#Troubleshooting">Troubleshooting</a> section.
+ </p>
+ <h2 id="Step_4_-_Restart_Eclipse">Step 4 - Restart Eclipse</h2>
+ <p>After running the install script, restart Eclipse using <u>File</u> > <u>Restart</u>. </p>
+ <p>If you need to uninstall the plug-in, run the
+ <i><code>uninstall.sh</code></i> or
+ <i><code>uninstall-noconsolehelper.sh</code></i> script before uninstalling it from within Eclipse. These scripts are also located in the
+ <i><code>natives/linux/scripts</code></i> subdirectory of the OProfile core plug-in directory (i.e. the same directory where the install scripts are found).
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="OProfile Reference.html" title="Overview">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="Launching-A-Profile.html" title="Launching A Profile">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Overview</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Launching A Profile</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Launching-A-Profile.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Launching-A-Profile.html
new file mode 100644
index 0000000000..6ce3aa3f6c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Launching-A-Profile.html
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Launching A Profile</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Launching A Profile</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Installation-and-Set-Up.html" title="Installation and Set-Up">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Profiling-Configuration.html" title="Profiling Configuration">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Installation and Set-Up</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Profiling Configuration</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Launching_A_Profile">Launching A Profile</h1>
+ <p>The purpose of the OProfile plug-in is to provide useful profile information in a user-friendly manner. To do this, it first gathers the required information. The plug-in hooks into the Eclipse and CDT's launching facilities; in doing so, profiling becomes as easy as a normal run of your program. </p>
+ <p>During a profile run, the OProfile plug-in will start, stop and perform other OProfile tasks in the background as needed, while the binary being profiled runs as normal. Currently, it is possible to start profiling when a user binary is run and stop after the binary has returned as well as the ability to start/stop profiling at arbitrary times.</p>
+ <h2 id="One-Click_Launch">One-Click Launch</h2>
+ <p>Most users are interested in profiling where a program spends the most CPU time during execution. The OProfile plug-in for Eclipse includes a
+ <i>one-click launch</i> feature which profiles this. The one-click launch sets appropriate defaults for a profile configuration using the
+ <i>execution time</i> event, and launches the profile with no further required user intervention.
+ </p>
+ <p>To use the one-click launch, right click on the
+ <i>project</i>, the
+ <i>binary</i> or in an
+ <i>open editor</i> for a source file belonging to that project. Then, navigate to <u>Profile As</u> and click <u>Profile With OProfile</u> to start the launch.
+ </p>
+ <p>
+ <img border="0" src="images/Screenshot-one-click_launch.png"/>
+ </p>
+ <h2 id="Launching_a_Customized_Profile">Launching a Customized Profile</h2>
+ <p>The OProfile plug-in allows you to configure a profile run using several available OProfile options. These options are exposed via the launch configuration in a user-friendly manner, allowing for a more complex profile. </p>
+ <p>To customize a profile, right click on the
+ <i>project</i>, the
+ <i>binary</i> or in an
+ <i>open editor</i> for a source file belonging to that project. Then, navigate to <u>Profile As</u> > <u>Profile Configurations...</u> to open the
+ <b>
+ <i>Profile Configurations</i>
+ </b> menu. Refer to the
+ <a href="Profiling-Configuration.html#Profiling_Configuration">Profiling Configuration</a> section for more information about configuring a profile.
+ </p>
+ <p>After configuring a profile, click the <u>Profile</u> button to launch the profile.</p>
+ <h2 id="Manual_Profile">Manual Profile</h2>
+ <p>As of the 0.3.0 release, users can profile their applications in two ways: an automatic or manual profile. Automatic is the previously described method whereby the OProfile daemon is started before the binary is launched and stopped after the binary returns. A manual profile configures the daemon with the appropriate settings, but instead a control dialog is available which the user can use to start or stop the OProfile daemon at will. Each mode has their own configuration type and icon, as to disambiguate the type of profile an entry in the profile history. A feedback list in the dialog assures the user that the operations have been received, since at times an operation may take a few seconds to complete. This feature is most useful to profile applications which halt on input, or large applications for which it is undesirable to launch and return several times. It is not recommended to use this feature to only profile when you believe your application is spending time; the statistical nature of OProfile will account for this.</p>
+ <p>
+ <img border="0" src="images/Oprofile_manual_dialog.png"/>
+ </p>
+ <p>
+ <img border="0" src="images/Oprofile_manual_shortcut.png"/>
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Installation-and-Set-Up.html" title="Installation and Set-Up">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="Profiling-Configuration.html" title="Profiling Configuration">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Installation and Set-Up</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Profiling Configuration</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference-toc.xml b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference-toc.xml
new file mode 100644
index 0000000000..b1ceaa9a03
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference-toc.xml
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<toc topic="userguide/OProfile Reference.html" label="OProfile Reference">
+ <topic href="userguide/OProfile Reference.html" label="Overview"></topic>
+ <topic href="userguide/Installation-and-Set-Up.html" label="Installation and Set-Up">
+ <topic href="userguide/Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts" label="Step 1 - Locate the Installation Scripts"></topic>
+ <topic href="userguide/Installation-and-Set-Up.html#Step_2_-_Choose_Which_Installation_Script_To_Run" label="Step 2 - Choose Which Installation Script To Run"></topic>
+ <topic href="userguide/Installation-and-Set-Up.html#Step_3_-_Running_The_Install_Script" label="Step 3 - Running The Install Script"></topic>
+ <topic href="userguide/Installation-and-Set-Up.html#Step_4_-_Restart_Eclipse" label="Step 4 - Restart Eclipse"></topic>
+ </topic>
+ <topic href="userguide/Launching-A-Profile.html" label="Launching A Profile">
+ <topic href="userguide/Launching-A-Profile.html#One-Click_Launch" label="One-Click Launch"></topic>
+ <topic href="userguide/Launching-A-Profile.html#Launching_a_Customized_Profile" label="Launching a Customized Profile"></topic>
+ <topic href="userguide/Launching-A-Profile.html#Manual_Profile" label="Manual Profile"></topic>
+ </topic>
+ <topic href="userguide/Profiling-Configuration.html" label="Profiling Configuration">
+ <topic href="userguide/Profiling-Configuration.html#Global_Settings" label="Global Settings"></topic>
+ <topic href="userguide/Profiling-Configuration.html#Event_Configuration" label="Event Configuration">
+ <topic href="userguide/Profiling-Configuration.html#Timer_Interrupt_Mode" label="Timer Interrupt Mode"></topic>
+ <topic href="userguide/Profiling-Configuration.html#Regular_Mode" label="Regular Mode"></topic>
+ </topic>
+ </topic>
+ <topic href="userguide/OProfile-View.html" label="OProfile View">
+ <topic href="userguide/OProfile-View.html#Features" label="Features">
+ <topic href="userguide/OProfile-View.html#View_Tree" label="View Tree"></topic>
+ <topic href="userguide/OProfile-View.html#View_Menu" label="View Menu"></topic>
+ </topic>
+ </topic>
+ <topic href="userguide/Example-Project.html" label="Example Project"></topic>
+ <topic href="userguide/Troubleshooting.html" label="Troubleshooting">
+ <topic href="userguide/Troubleshooting.html#Install_Script_Errors" label="Install Script Errors">
+ <topic href="userguide/Troubleshooting.html#Error:_script_must_be_run_as_the_root_user" label="Error: script must be run as the root user"></topic>
+ <topic href="userguide/Troubleshooting.html#Error:_script_must_be_run_with_pwd_in_script_dir" label="Error: script must be run with pwd in script dir"></topic>
+ <topic href="userguide/Troubleshooting.html#Error:_required_binaries_do_not_exist.2C_OProfile_not_installed.3F" label="Error: required binaries do not exist, OProfile not installed?"></topic>
+ <topic href="userguide/Troubleshooting.html#Error:_.2Fusr.2Fbin.2Fconsolehelper_does_not_exist.2C_run_install-noconsolehelper.sh_instead" label="Error: /usr/bin/consolehelper does not exist, run install-noconsolehelper.sh instead"></topic>
+ <topic href="userguide/Troubleshooting.html#Error:_cannot_create_opcontrol_wrapper_in_.3Cdirectory.3E" label="Error: cannot create opcontrol wrapper in &lt;directory>"></topic>
+ <topic href="userguide/Troubleshooting.html#Error:_cannot_find_opxml_binary.2C_required_plugin_missing" label="Error: cannot find opxml binary, required plugin missing"></topic>
+ </topic>
+ <topic href="userguide/Troubleshooting.html#No_Samples_From_A_Profile" label="No Samples From A Profile"></topic>
+ <topic href="userguide/Troubleshooting.html#Log_Reader_Hangs" label="Log Reader Hangs"></topic>
+ <topic href="userguide/Troubleshooting.html#Errors_Related_to_opxml" label="Errors Related to opxml"></topic>
+ <topic href="userguide/Troubleshooting.html#Rebuilding_opxml" label="Rebuilding opxml">
+ <topic href="userguide/Troubleshooting.html#Ubuntu_-_Extra_Requirements" label="Ubuntu - Extra Requirements"></topic>
+ </topic>
+ </topic>
+ <topic href="userguide/Updating-This-Document.html" label="Updating This Document"></topic>
+</toc> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.html
new file mode 100644
index 0000000000..8d395e9aed
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.html
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">OProfile Reference</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left"></td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Installation-and-Set-Up.html" title="Installation and Set-Up">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top"></td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Installation and Set-Up</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Overview">Overview</h1>
+ <p>OProfile is a system-wide Linux profiler, capable of running at low overhead. It consists of a kernel driver and a daemon for collecting raw sample data, along with a suite of tools for parsing that data into meaningful information. OProfile is generally used by developers to determine which sections of code consume the most amount of CPU time, and why.</p>
+ <p>The OProfile plug-in allows Eclipse users to seamlessly include OProfile capabilities into their development workflow, regardless of their experience in using OProfile. Users with little experience in OProfile can use the
+ <a href="Launching-A-Profile.html#One-Click_Launch">One-Click Launch</a> to run a default OProfile view. Experienced users can perform the same OProfile functions they would on the command line, but with a much richer visualization of the results.
+ </p>
+ <p>For more details on OProfile, visit the project homepage at
+ <a href="http://oprofile.sourceforge.net/news/">http://oprofile.sourceforge.net/news/</a>.
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left"></td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Installation-and-Set-Up.html" title="Installation and Set-Up">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top"></td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Installation and Set-Up</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.xml b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.xml
new file mode 100644
index 0000000000..3033bdcaea
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile Reference.xml
@@ -0,0 +1,959 @@
+<?xml version='1.0' ?><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<book>
+ <title>OProfile Reference</title>
+ <chapter id="Overview">
+ <title>Overview</title>
+ <para>OProfile is a system-wide Linux profiler, capable of running at low overhead. It consists of a kernel driver and a daemon for collecting raw sample data, along with a suite of tools for parsing that data into meaningful information. OProfile is generally used by developers to determine which sections of code consume the most amount of CPU time, and why.</para>
+ <para>The OProfile plug-in allows Eclipse users to seamlessly include OProfile capabilities into their development workflow, regardless of their experience in using OProfile. Users with little experience in OProfile can use the
+ <link linkend="One-Click_Launch">One-Click Launch</link> to run a default OProfile view. Experienced users can perform the same OProfile functions they would on the command line, but with a much richer visualization of the results.
+ </para>
+ <para>For more details on OProfile, visit the project homepage at
+ <ulink url="http://oprofile.sourceforge.net/news/">http://oprofile.sourceforge.net/news/</ulink>.
+ </para>
+ </chapter>
+ <chapter id="Installation_and_Set-Up">
+ <title>Installation and Set-Up</title>
+ <para>The easiest way to install the OProfile plug-in for Eclipse is through the
+ <emphasis role="bold">''Software Updates and Add-ons '</emphasis>' menu. For information on how to use this menu, refer to
+ <ulink url="http://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp#Installing_Updates_From_the_Linux_Tools_Update_Site">http://wiki.eclipse.org/Linux_Tools_Project/PluginInstallHelp#Installing_Updates_From_the_Linux_Tools_Update_Site</ulink>.
+ </para>
+ <para>Unlike most Eclipse plug-ins, the OProfile plug-in requires some configuration after installation. Note that this configuration process takes only a few simple steps, and only needs to be done once.</para>
+ <para>After the plug-in is first installed, performing a profile run with OProfile will bring up a dialog similar to the following:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-installscript_error_dialog.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>As the dialog suggests, you must run the supplied install script; this script will allow the OProfile plug-in to perform OProfile tasks as root (since OProfile cannot be run as an unprivileged user). The steps below are the same as the dialog but described in more detail.</para>
+ <section id="Step_1_-_Locate_the_Installation_Scripts">
+ <title>Step 1 - Locate the Installation Scripts</title>
+ <para>Open up a terminal and locate the
+ <emphasis role="italic"><code>natives/linux/scripts</code></emphasis> subdirectory, which is found in the
+ <emphasis role="italic"><code>org.eclipse.linuxtools.oprofile.core</code></emphasis> plug-in directory. The location of this plug-in directory depends on how you installed Eclipse.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>If you are using a distro-supplied version of Eclipse and installed the plug-in via the update site, the plug-in directory will most likely be under
+ <emphasis role="italic"><code>~/.eclipse</code></emphasis>. To find the exact location of the plug-in directory in this case, use the following command:
+ </para>
+ <variablelist>
+ <listitem>
+ <para><code>find ~/.eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'</code></para>
+ </listitem>
+ </variablelist>
+ </listitem>
+ <listitem>
+ <para>Alternatively, if you are using an extracted tarball of Eclipse (i.e. you downloaded a
+ <emphasis role="italic"><code>.tar.gz</code></emphasis> from
+ <ulink url="http://www.eclipse.org/downloads/">http://www.eclipse.org/downloads/</ulink>), then the plug-in will most likely be in the <code>plugins</code> sub-directory of where you extracted it.
+ </para>
+ <variablelist>
+ <listitem>
+ <para>For example, if you extracted the tarball to <code>
+ <emphasis role="italic">/home/ksebasti</emphasis></code>, your Eclipse installation would be in <code>
+ <emphasis role="italic">/home/ksebasti/eclipse</emphasis></code>. In this case, you should use the following command to find the exact location of the plug-in directory:
+ </para>
+ </listitem>
+ <listitem>
+ <para><code>find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'</code></para>
+ </listitem>
+ </variablelist>
+ </listitem>
+ </itemizedlist>
+ <para>
+ <emphasis role="bold">Note:</emphasis> In both cases, the quotes (') and asterisk (*) are necessary.
+ </para>
+ <para>Sample output will look like this:</para>
+ <literallayout>$ find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core_*'
+/home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051
+</literallayout>
+ <para>Once you find the plug-in directory, navigate to its <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> subdirectory. Using our previous example:
+<code> cd /home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core_0.2.0.200904131051/natives/linux/scripts</code>
+ </para>
+ <para>The <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> subdirectory contains the installation scripts you will need to run in order to allow OProfile to run as root.
+ </para>
+ </section>
+ <section id="Step_2_-_Choose_Which_Installation_Script_To_Run">
+ <title>Step 2 - Choose Which Installation Script To Run</title>
+ <para>The
+ <emphasis role="italic"><code>natives/linux/scripts</code></emphasis> subdirectory contains two scripts:
+ <emphasis role="italic"><code>install.sh</code></emphasis> and
+ <emphasis role="italic"><code>install-noconsolehelper.sh</code></emphasis>. Both scripts perform sanity checks to ensure OProfile is installed and that <code>opxml</code>, a C++ program required to interface with OProfile, exists and can be run. The difference is in how root authentication with the plug-in is set up.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis role="italic"><code>install.sh</code></emphasis> uses the pluggable authentication modules (PAM) mechanism. This is the default and recommended method for root authentication. When an OProfile task is required, you will be presented with this dialog to enter the root password:
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-opcontrol_consolehelper.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis role="italic"><code>install-noconsolehelper.sh</code></emphasis> can be used when <code>consolehelper</code> is not present on the system, or if required PAM modules are not on the system. It uses the sudo mechanism and a small wrapper script. The install script will describe the text which should be written in the
+ <emphasis role="italic"><code>sudoers</code></emphasis> file, then run the command <code>visudo</code> to edit it.
+ '
+ <emphasis role="italic">Warning:</emphasis>' The
+ <emphasis role="italic"><code>sudoers</code></emphasis> file is a sensitive system file and altering it in other ways may lead to system instability. Only users with enough knowledge of running a Linux system should use this method. For these reasons, this method of root authentication is discouraged. However, it may be the only option available to some users and it has been tested to work by developers and users of the plug-in.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="Step_3_-_Running_The_Install_Script">
+ <title>Step 3 - Running The Install Script</title>
+ <para>Once you have selected an install script, log in as root. Assuming you are in the
+ <emphasis role="italic"><code>natives/linux/scripts</code></emphasis> subdirectory of the plug-in directory (as in
+ <link linkend="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</link>), run your selected install script:
+ </para>
+ <variablelist>
+ <listitem>
+ <para><code>./install.sh</code></para>
+ </listitem>
+ </variablelist>
+ <para>Successful output will look like this:</para>
+ <literallayout>./install.sh
+Eclipse-OProfile plugin install successful.
+</literallayout>
+ <para>Either install script should be run as the root user since both scripts perform some actions that require elevated privileges:
+ <emphasis role="italic"><code>install.sh</code></emphasis> places files in
+ <emphasis role="italic"><code>/etc</code></emphasis> subdirectories, while
+ <emphasis role="italic"><code>install-noconsolehelper.sh</code></emphasis> runs the command <code>visudo</code>. If you wish to simply run either install script without logging in as root, use:
+ </para>
+ <variablelist>
+ <listitem>
+ <para><code>su -c './install.sh'</code></para>
+ </listitem>
+ </variablelist>
+ <para>This command will run only the install script as the root user, then return control to the regular user. Note that you will still need to enter the root password to make this work. If you receive an error message, refer to the
+ <link linkend="Troubleshooting">Troubleshooting</link> section.
+ </para>
+ </section>
+ <section id="Step_4_-_Restart_Eclipse">
+ <title>Step 4 - Restart Eclipse</title>
+ <para>After running the install script, restart Eclipse using <u>File</u> > <u>Restart</u>. </para>
+ <para>If you need to uninstall the plug-in, run the
+ <emphasis role="italic"><code>uninstall.sh</code></emphasis> or
+ <emphasis role="italic"><code>uninstall-noconsolehelper.sh</code></emphasis> script before uninstalling it from within Eclipse. These scripts are also located in the
+ <emphasis role="italic"><code>natives/linux/scripts</code></emphasis> subdirectory of the OProfile core plug-in directory (i.e. the same directory where the install scripts are found).
+ </para>
+ </section>
+ </chapter>
+ <chapter id="Launching_A_Profile">
+ <title>Launching A Profile</title>
+ <para>The purpose of the OProfile plug-in is to provide useful profile information in a user-friendly manner. To do this, it first gathers the required information. The plug-in hooks into the Eclipse and CDT's launching facilities; in doing so, profiling becomes as easy as a normal run of your program. </para>
+ <para>During a profile run, the OProfile plug-in will start, stop and perform other OProfile tasks in the background as needed, while the binary being profiled runs as normal. Currently, it is possible to start profiling when a user binary is run and stop after the binary has returned as well as the ability to start/stop profiling at arbitrary times.</para>
+ <section id="One-Click_Launch">
+ <title>One-Click Launch</title>
+ <para>Most users are interested in profiling where a program spends the most CPU time during execution. The OProfile plug-in for Eclipse includes a
+ <emphasis role="italic">one-click launch</emphasis> feature which profiles this. The one-click launch sets appropriate defaults for a profile configuration using the
+ <emphasis role="italic">execution time</emphasis> event, and launches the profile with no further required user intervention.
+ </para>
+ <para>To use the one-click launch, right click on the
+ <emphasis role="italic">project</emphasis>, the
+ <emphasis role="italic">binary</emphasis> or in an
+ <emphasis role="italic">open editor</emphasis> for a source file belonging to that project. Then, navigate to <u>Profile As</u> and click <u>Profile With OProfile</u> to start the launch.
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-one-click_launch.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="Launching_a_Customized_Profile">
+ <title>Launching a Customized Profile</title>
+ <para>The OProfile plug-in allows you to configure a profile run using several available OProfile options. These options are exposed via the launch configuration in a user-friendly manner, allowing for a more complex profile. </para>
+ <para>To customize a profile, right click on the
+ <emphasis role="italic">project</emphasis>, the
+ <emphasis role="italic">binary</emphasis> or in an
+ <emphasis role="italic">open editor</emphasis> for a source file belonging to that project. Then, navigate to <u>Profile As</u> > <u>Profile Configurations...</u> to open the
+ <emphasis role="bold">
+ <emphasis role="italic">Profile Configurations</emphasis>
+ </emphasis> menu. Refer to the
+ <link linkend="Profiling_Configuration">Profiling Configuration</link> section for more information about configuring a profile.
+ </para>
+ <para>After configuring a profile, click the <u>Profile</u> button to launch the profile.</para>
+ </section>
+ <section id="Manual_Profile">
+ <title>Manual Profile</title>
+ <para>As of the 0.3.0 release, users can profile their applications in two ways: an automatic or manual profile. Automatic is the previously described method whereby the OProfile daemon is started before the binary is launched and stopped after the binary returns. A manual profile configures the daemon with the appropriate settings, but instead a control dialog is available which the user can use to start or stop the OProfile daemon at will. Each mode has their own configuration type and icon, as to disambiguate the type of profile an entry in the profile history. A feedback list in the dialog assures the user that the operations have been received, since at times an operation may take a few seconds to complete. This feature is most useful to profile applications which halt on input, or large applications for which it is undesirable to launch and return several times. It is not recommended to use this feature to only profile when you believe your application is spending time; the statistical nature of OProfile will account for this.</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Oprofile_manual_dialog.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Oprofile_manual_shortcut.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ </chapter>
+ <chapter id="Profiling_Configuration">
+ <title>Profiling Configuration</title>
+ <para>OProfile has many configuration options, the amount of which can be overwhelming. For more information about these options, refer to
+ <ulink url="http://oprofile.sourceforge.net/doc/controlling.html">http://oprofile.sourceforge.net/doc/controlling.html</ulink>. The
+ <emphasis role="bold">
+ <emphasis role="italic">Profile Configurations</emphasis>
+ </emphasis> menu provided by the OProfile plug-in aims to make relevant, commonly-used OProfile configuration options easily accessible to users of all experience levels. Currently, the
+ <emphasis role="bold">
+ <emphasis role="italic">Profile Configurations</emphasis>
+ </emphasis> menu provides two configuration tabs to the standard CDT launch configuration:
+ <link linkend="Global_Settings">Global Settings</link> and
+ <link linkend="Event_Configuration">Event Configuration</link>.
+ </para>
+ <section id="Global_Settings">
+ <title>Global Settings</title>
+ <para>The
+ <emphasis role="bold">
+ <emphasis role="italic">Global Settings</emphasis>
+ </emphasis> tab configures how the OProfile daemon gathers profiling information. Each option is described below.
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-global_config.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>Kernel Image File (optional)</term>
+ <listitem>
+ <para>To collect more detailed information about the operation of a program in the Linux kernel, use the <u>Browse</u> button specify the location of your running kernel's
+ <emphasis role="italic"><code>vmlinux</code></emphasis> file. A kernel's
+ <emphasis role="italic"><code>vmlinux</code></emphasis> file contains debugging information required by OProfile. Note that the compressed
+ <emphasis role="italic">vmlinux</emphasis> file, often named
+ <emphasis role="italic"><code>vmlinuz</code></emphasis>, cannot be used for this purpose.
+ Note: For this option to have any effect, you must enable the
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent kernel modules</emphasis>
+ </emphasis> option.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Include dependent shared libraries</term>
+ <listitem>
+ <para>This option will make OProfile include samples from shared libraries that are used by the profiled binary/program. These samples will then be aggregated in the profile results.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Include dependent kernel modules</term>
+ <listitem>
+ <para>This option will make OProfile include samples related to running in the kernel. If the
+ <emphasis role="italic"><code>vmlinux</code></emphasis> file is specified, the profile will include details of the specific kernel modules in use. Otherwise, kernel samples will be grouped under the name <code>no-vmlinux</code>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>The differences between the options are illustrated in the following OProfile view screenshot:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofile_global_differences.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para><code>incl_library</code> was run with only the
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent shared libraries</emphasis>
+ </emphasis> checked
+ </para>
+ </listitem>
+ <listitem>
+ <para><code>incl_vmlinux</code> was run with the
+ <emphasis role="italic"><code>vmlinux</code></emphasis> file specified; both
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent shared libraries</emphasis>
+ </emphasis> and
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent kernel modules</emphasis>
+ </emphasis> checked
+ </para>
+ </listitem>
+ <listitem>
+ <para><code>no_vmlinux</code> was run without any
+ <emphasis role="italic"><code>vmlinux</code></emphasis> file specified; both
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent shared libraries</emphasis>
+ </emphasis> and
+ <emphasis role="bold">
+ <emphasis role="italic">Include dependent kernel modules</emphasis>
+ </emphasis> checked
+ </para>
+ </listitem>
+ <listitem>
+ <para><code>novmlinux_noseparate</code> was run with none of the options checked</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="Event_Configuration">
+ <title>Event Configuration</title>
+ <para>Your system processor's hardware profiling registers often contain a large number of options. The
+ <emphasis role="bold">
+ <emphasis role="italic">Event Configuration</emphasis>
+ </emphasis> tab condenses these options to a more manageable amount.
+ </para>
+ <section id="Timer_Interrupt_Mode">
+ <title>Timer Interrupt Mode</title>
+ <para>If your processor (or kernel) does not support the hardware profiling registers OProfile uses, OProfile will run in
+ <emphasis role="italic">timer-interrupt mode</emphasis>. This mode has no user-configurable events. For more information about
+ <emphasis role="italic">timer-interrupt mode</emphasis>, refer to
+ <ulink url="http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer">http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer</ulink>.
+ </para>
+ <para>The event configuration tab will then look like the screenshot below:</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofile_event_timer.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ <section id="Regular_Mode">
+ <title>Regular Mode</title>
+ <para>If your processor (or kernel) supports hardware profiling registers, there are several configuration options available to you. The availability of these configuration options depend on your processor model or kernel version. With proper support, the
+ <emphasis role="bold">
+ <emphasis role="italic">Events</emphasis>
+ </emphasis> configuration tab will look like the following screenshot:
+ </para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofile_eventconfig.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>In
+ <emphasis role="italic">regular mode</emphasis>, the
+ <emphasis role="bold">
+ <emphasis role="italic">Events</emphasis>
+ </emphasis> configuration tab can contain any of the following options:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term>Use default event</term>
+ <listitem>
+ <para>This option is enabled by default when creating a new profile configuration, or when a profile configuration is created through the
+ <link linkend="One-Click_Launch">one-click launch</link>.
+ <emphasis role="bold">
+ <emphasis role="italic">Use default event</emphasis>
+ </emphasis> is a shortcut to use an event based on processor execution time, with a reasonable value for the
+ <emphasis role="bold">
+ <emphasis role="italic">Count</emphasis>
+ </emphasis> option. Using this option will prevent you from configuring the counters any further.
+ For a list of default events for various processors, refer to
+ <ulink url="http://oprofile.sourceforge.net/doc/controlling.html#eventspec">http://oprofile.sourceforge.net/doc/controlling.html#eventspec</ulink>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Counter Tabs (
+ <emphasis role="bold">
+ <emphasis role="italic">Ctr 0</emphasis>
+ </emphasis>,
+ <emphasis role="bold">
+ <emphasis role="italic">Ctr 1</emphasis>
+ </emphasis>,
+ <emphasis role="bold">
+ <emphasis role="italic">Ctr 2</emphasis>
+ </emphasis>, and so on)
+ </term>
+ <listitem>
+ <para>A processor may have 1 to 8 hardware profiling registers (also called counters). Each one may be programmed separately to profile many events simultaneously. Each tabs labelled
+ <emphasis role="italic">Ctr</emphasis> represents one counter and exposes the same options.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Enabled</term>
+ <listitem>
+ <para>This option (located in each counter tab) disables or enables a counter.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Event List</term>
+ <listitem>
+ <para>A list of the events available for profiling on a given counter.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Event Description</term>
+ <listitem>
+ <para>When you select an event from the events list, this field provides a short description of that event's function. OProfile provides the content for this field.</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Profile Kernel and Profile user binaries</term>
+ <listitem>
+ <para>Instructs OProfile to profile binaries in the selected spaces. Keeping both checked is recommended (even if other
+ <link linkend="Global_Settings">Global Settings</link> are not specified).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Count</term>
+ <listitem>
+ <para>Specifies a reset count for the hardware counter. In most cases, the default value (based on the CPU clock frequency) is sufficient. Each event has a minimum value, but it is recommended to use a value many orders of magnitude larger.
+
+ <emphasis role="bold">WARNING</emphasis>: if you specify a value that is too low, the profiled program may take much longer to return or your system may hang.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Unit Mask</term>
+ <listitem>
+ <para>Many events have a
+ <emphasis role="italic">unit mask</emphasis> which allows further narrowing of the scope of the event. If in doubt, use the default value (specified by OProfile). There are three types of unit masks:
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <itemizedlist>
+ <listitem>
+ <para>Mandatory -- no selection necessary; a single required value</para>
+ </listitem>
+ <listitem>
+ <para>Exclusive -- several possible values; a single required value</para>
+ </listitem>
+ <listitem>
+ <para>Bitmask -- several possible values; a combination of several values</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+ </chapter>
+ <chapter id="OProfile_View">
+ <title>OProfile View</title>
+ <para>The OProfile view is the central point of interaction of the plug-in with the results of profiling.</para>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofile_view_full.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ <para>The tree structure displayed above describes one or more profiles of one or more events in the following manner:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_event.gif"/>
+ </imageobject>
+ </mediaobject> Events -- the name of the profiling event used by OProfile (e.g. <code>CPU_CLK_UNHALTED</code>)
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_session.gif"/>
+ </imageobject>
+ </mediaobject> Session -- the name of the session the profile is stored in (e.g. <code>run1</code>)
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_image.gif"/>
+ </imageobject>
+ </mediaobject> Image -- the binary being profiled (e.g.
+ <emphasis role="italic"><code>/notnfs/ksebasti/oprofile/plugin/factorial/Debug/factorial</code></emphasis>)
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_symbol.gif"/>
+ </imageobject>
+ </mediaobject> Symbol -- symbols gathered from the binary's debug information (e.g. <code>factorial2</code>)
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_sample.gif"/>
+ </imageobject>
+ </mediaobject> Sample -- individual OProfile samples correlated to line numbers of source code
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_dependent.gif"/>
+ </imageobject>
+ </mediaobject> Dependent Images -- other binaries related to the run of the program; shared libraries or kernel modules
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_image.gif"/>
+ </imageobject>
+ </mediaobject> Image -- the dependent binary
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_symbol.gif"/>
+ </imageobject>
+ </mediaobject> Symbol -- same as above
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_sample.gif"/>
+ </imageobject>
+ </mediaobject> Sample -- same as above
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <para>If source code is not available, some symbols (including source file name) may be shown, but no samples. This is normally the case with programs that use shared libraries. Also, depending on the
+ <link linkend="Global_Settings">Global Settings</link>, a profile may have no dependent images.
+ </para>
+ <para>Note that after Eclipse is restarted, there will be no data shown in the OProfile view. Data from past profiles will still be on the system, if not touched otherwise, and can be re-read with the <u>Refresh View</u> menu action (refer to the
+ <link linkend="View_Menu">View Menu</link> section for more details).
+ </para>
+ <section id="Features">
+ <title>Features</title>
+ <para>This section describes the features of the plug-in exposed through the view.</para>
+ <section id="View_Tree">
+ <title>View Tree</title>
+ <para>Double-clicking on a
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Icon-oprofile_sample.gif"/>
+ </imageobject>
+ </mediaobject>sample will open the source file in an editor and place the insertion point at the corresponding line in code.
+ </para>
+ <para>
+ <emphasis role="bold">Note:</emphasis> For this to work, the source code must be available and it must be in the correct directory (as described in the debug info of the binary).
+ </para>
+ </section>
+ <section id="View_Menu">
+ <title>View Menu</title>
+ <variablelist>
+ <varlistentry>
+ <term>Open OProfile Daemon Log</term>
+ <listitem>
+ <para>This will launch a dialog showing the contents of the OProfile daemon log.
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofiled_log_reader.png"/>
+ </imageobject>
+ </mediaobject>
+ By default, the OProfile daemon log is in <code>
+ <emphasis role="italic">/var/lib/oprofile/samples/oprofiled.log</emphasis></code>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Refresh View</term>
+ <listitem>
+ <para>This will re-read the OProfile data on the system, re-create the internal data model and re-display the profile tree. Doing so allows you to display data already on the system without launching a profile (e.g. when Eclipse first starts up).</para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <varlistentry>
+ <term>Save Default Session</term>
+ <listitem>
+ <para>The default session, named <code>current</code>, is overwritten on each launch of a profile if it is not saved. If you wish to keep a profile for later viewing, this menu action will allow you to save the session to a different name.
+ Since the samples are in a system directory, this operation requires root privileges; hence, you will be prompted for the root password. The
+ <emphasis role="bold">
+ <emphasis role="italic">Save Session</emphasis>
+ </emphasis> dialog is shown below:
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="Screenshot-oprofile_save_session.png"/>
+ </imageobject>
+ </mediaobject>
+ </para>
+ </section>
+ </section>
+ </chapter>
+ <chapter id="Example_Project">
+ <title>Example Project</title>
+ <para>If you wish to try the documented steps in this article with a test project, you can download the same sample project used to create the screenshots at the following link:</para>
+ <para>
+ <ulink url="http://wiki.eclipse.org/images/7/77/Eclipse-oprofile_testproj_factorial.zip">http://wiki.eclipse.org/images/7/77/Eclipse-oprofile_testproj_factorial.zip</ulink>
+ </para>
+ <para>To import the project into the Eclipse workspace, navigate to <u>File</u> > <u>Import</u> > <u>General</u> > <u>Existing Projects into Workspace</u>. Then, choose <u>Select archive file</u> and use the <u>Browse</u> button to point to the location of the sample project on your file system.</para>
+ </chapter>
+ <chapter id="Troubleshooting">
+ <title>Troubleshooting</title>
+ <para>Various problems and their solutions are described here. If you encounter a problem not described here, please
+ <ulink url="https://bugs.eclipse.org/bugs/enter_bug.cgi?assigned_to=ksebasti%40redhat.com&amp;blocked=&amp;bug_file_loc=http%3A%2F%2F&amp;bug_severity=normal&amp;bug_status=NEW&amp;comment=&amp;component=OProfile&amp;contenttypeentry=&amp;contenttypemethod=autodetect&amp;contenttypeselection=text%2Fplain&amp;data=&amp;dependson=&amp;description=&amp;flag_type-1=X&amp;flag_type-2=X&amp;flag_type-4=X&amp;flag_type-6=X&amp;flag_type-7=X&amp;flag_type-8=X&amp;form_name=enter_bug&amp;keywords=&amp;op_sys=Linux&amp;priority=P3&amp;product=Linux%20Tools&amp;qa_contact=&amp;rep_platform=PC&amp;short_desc=">file a bug</ulink>.
+ </para>
+ <section id="Install_Script_Errors">
+ <title>Install Script Errors</title>
+ <para>This section describes different errors that could occur from running the install scripts (i.e. <code>
+ <emphasis role="italic">install.sh</emphasis></code> or <code>
+ <emphasis role="italic">install-noconsolehelper.sh</emphasis></code>)
+ </para>
+ <section id="Error:_script_must_be_run_as_the_root_user">
+ <title>Error: script must be run as the root user</title>
+ <para>You attempted to run the script as an ordinary, non-root user. You must be the root user to run the install script, as the scripts edit files located in root-owned directories. </para>
+ <para>Solution: Run the command <code>su -</code> to become the root user, or run the script as the root user with <code>su -c './install.sh'</code>.</para>
+ </section>
+ <section id="Error:_script_must_be_run_with_pwd_in_script_dir">
+ <title>Error: script must be run with pwd in script dir</title>
+ <para>Your current working directory must be the <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> subdirectory of the OProfile core plug-in; running the script relative from another location will not work.
+ </para>
+ <para>Solution: Simply follow the steps on
+ <link linkend="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</link> to find the <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> subdirectory of the OProfile core plug-in.
+ </para>
+ </section>
+ <section id="Error:_required_binaries_do_not_exist.2C_OProfile_not_installed.3F">
+ <title>Error: required binaries do not exist, OProfile not installed?</title>
+ <para>The OProfile plug-in could not find the <code>
+ <emphasis role="italic">oprofiled</emphasis></code> and <code>
+ <emphasis role="italic">opcontrol</emphasis></code> binaries. This could mean they are not in their default directory (<code>
+ <emphasis role="italic">/usr/bin</emphasis></code>), or they do not exist at all.
+ </para>
+ <para>Solution: If the binaries are on your system (and in your <code>PATH</code>) but not in those directories, you can either remove these checks from the install script or create symlinks in the <code>
+ <emphasis role="italic">/usr/bin</emphasis></code> directory. Of course, if the binaries do not exist on your system, then install the <code>
+ <emphasis role="italic">oprofile</emphasis></code> package.
+ </para>
+ </section>
+ <section id="Error:_.2Fusr.2Fbin.2Fconsolehelper_does_not_exist.2C_run_install-noconsolehelper.sh_instead">
+ <title>Error: /usr/bin/consolehelper does not exist, run install-noconsolehelper.sh instead</title>
+ <para>You ran the <code>
+ <emphasis role="italic">install.sh</emphasis></code> script, but <code>consolehelper</code> was not installed on your system.
+ As described in
+ <link linkend="Step_2_-_Choose_Which_Installation_Script_To_Run">Step 2 - Choose Which Installation Script To Run</link>, if <code>consolehelper</code> is not installed, then you will need to use a root authentication mode that uses the <code>sudo</code> mechanism.
+ </para>
+ <para>Solution: Run the <code>
+ <emphasis role="italic">install-noconsolehelper.sh</emphasis></code> script instead.
+ </para>
+ </section>
+ <section id="Error:_cannot_create_opcontrol_wrapper_in_.3Cdirectory.3E">
+ <title>Error: cannot create opcontrol wrapper in &lt;directory></title>
+ <para>The <code>ln</code> command reports that the symlink could not be created. This can occur if the <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> subdirectory is located on an NFS mount; the NFS server will not allow the local root user to create files in the directory.
+ </para>
+ <para>Solution: Before running the <code>
+ <emphasis role="italic">install.sh</emphasis></code> script, first create the symlink as a regular user by running the command <code>ln -s /usr/bin/consolehelper opcontrol</code>. Then, remove the following section from the <code>
+ <emphasis role="italic">install.sh</emphasis></code> script:
+ </para>
+ <literallayout>#create the sym link to consolehelper
+test -L ./opcontrol || { rm -f ./opcontrol &amp;&amp; ln -s /usr/bin/consolehelper opcontrol ; }
+if [ $? -ne 0 ]; then
+ echo Error: cannot create opcontrol wrapper in `pwd`
+ exit 1
+fi
+</literallayout>
+ <para>The <code>
+ <emphasis role="italic">install.sh</emphasis></code> script is fixed in the most recent version of the OProfile plug-in for Eclipse, but not in the 0.2.0 release.
+ </para>
+ </section>
+ <section id="Error:_cannot_find_opxml_binary.2C_required_plugin_missing">
+ <title>Error: cannot find opxml binary, required plugin missing</title>
+ <para>This can occur if the native binary <code>
+ <emphasis role="italic">opxml</emphasis></code> is not found. This binary is required for proper operation of the plug-in.
+ </para>
+ <para>Solution: If the <code>
+ <emphasis role="italic">org.eclipse.linuxtools.oprofile.core.linux.{x86,x86_64,ppc}</emphasis></code> directories exist (in the Eclipse <code>
+ <emphasis role="italic">plugins</emphasis></code> directory), refer to the
+ <link linkend="Rebuilding_opxml">Rebuilding opxml</link> section for instructions on rebuilding the binary and placing it in the proper directory. Otherwise, re-install the plug-in.
+ </para>
+ </section>
+ </section>
+ <section id="No_Samples_From_A_Profile">
+ <title>No Samples From A Profile</title>
+ <para>It is possible for a profile run of a program to return no samples, resulting in no <code>current</code> session displayed. This is not always indicative of a problem with either OProfile or the profiled program. OProfile is a system-wide profiling tool; hence, other active processes running on your system may overshadow your program. This is particularly true if the profiled program is not CPU intensive. </para>
+ <para>In addition, the
+ <emphasis role="italic">Event</emphasis> you choose (selected through the
+ <emphasis role="bold">
+ <emphasis role="italic">Events</emphasis>
+ </emphasis> tab, as described in
+ <link linkend="Regular_Mode">Regular Mode</link>) could cause a profile to return no samples; for example the event
+ <emphasis role="italic">BR_CND_MISSP_EXEC</emphasis> will only provide samples if a branch was mispredicted by the processor. Note also that due to the statistical nature of OProfile, profiling is neither deterministic nor consistent; two subsequent runs may output very different results. In some cases, one run can result in no samples, while another run on the same program can result in many samples. The OProfile online documentation has other useful information
+ <ulink url="http://oprofile.sourceforge.net/doc/results.html#no-results">here</ulink>.
+ </para>
+ <para>Solution: The following suggestions could help you generate more samples from a profile run:</para>
+ <itemizedlist>
+ <listitem>
+ <para>run your program with a larger input</para>
+ </listitem>
+ <listitem>
+ <para>halt or kill as many other non-essential processes as possible </para>
+ </listitem>
+ <listitem>
+ <para>reduce the
+ <emphasis role="italic">Count</emphasis> in the
+ <link linkend="Event_Configuration">Event Configuration</link> tab
+ </para>
+ </listitem>
+ <listitem>
+ <para>launch a profile several times </para>
+ </listitem>
+ </itemizedlist>
+ <para>If you are unsure whether your configuration is working correctly, try profiling the sample project in the
+ <link linkend="Example_Project">Example Project</link> section.
+ </para>
+ </section>
+ <section id="Log_Reader_Hangs">
+ <title>Log Reader Hangs</title>
+ <para>If the OProfile daemon log file is too large, the log reader may hang and possibly cause the OProfile plug-in to crash. This occurs when the
+ <emphasis role="italic">verbosity</emphasis> option is set to <code>all</code>, which results in several hundred MiB of text in the log over several profile runs. If you do require all this data in the log file, do not launch the log reader. Delete or backup the log file before running the log reader again.
+ </para>
+ </section>
+ <section id="Errors_Related_to_opxml">
+ <title>Errors Related to opxml</title>
+ <para><code>opxml</code> is the native program that bridges OProfile and the OProfile plug-in for Eclipse. In some cases, some errors may be caused by problems with <code>opxml</code>. To verify if this is the case, run <code>opxml</code>.</para>
+ <para><code>opxml</code> is normally located in the Eclipse <code>
+ <emphasis role="italic">plugins</emphasis></code> directory, similar to the install scripts described in
+ <link linkend="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</link>. However, depending on your platform, the location of <code>opxml</code> will be different. To determine what your platform is, run the following command at a terminal:
+ </para>
+ <variablelist>
+ <listitem>
+ <para></para>
+ <variablelist>
+ <listitem>
+ <para><code>uname -m</code></para>
+ </listitem>
+ </variablelist>
+ </listitem>
+ </variablelist>
+ <para>Depending on the output, locate the following directory in the same manner as
+ <link linkend="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</link>, and change into that directory:
+ </para>
+ <informaltable>
+ <tr>
+ <th>Output from <code>uname -m</code></th>
+ <th>Directory to use in <code>find</code> command</th>
+ <th>Sub-directory to change to</th>
+ </tr>
+ <tr>
+ <td>i386, i468, i568, i686, x86</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.x86</td>
+ <td>os/linux/x86</td>
+ </tr>
+ <tr>
+ <td>x86_64</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.x86_64</td>
+ <td>os/linux/x86_64</td>
+ </tr>
+ <tr>
+ <td>ppc, ppc64</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.ppc</td>
+ <td>os/linux/ppc</td>
+ </tr>
+ </informaltable>
+ <para>For example, if you are running Eclipse on a 64bit machine (i.e. x86_64), you should run the following command to find the location of <code>opxml</code>:</para>
+ <variablelist>
+ <listitem>
+ <para><code>$ find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core.linux.x86_64_*'</code></para>
+ </listitem>
+ </variablelist>
+ <para>This will display the following output (or similar):</para>
+ <variablelist>
+ <listitem>
+ <para><code>/home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core.linux.x86_64_0.2.0.200904201514</code></para>
+ </listitem>
+ </variablelist>
+ <para>Navigate into that directory:</para>
+ <variablelist>
+ <listitem>
+ <para><code>$ cd /home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core.linux.x86_64_0.2.0.200904201514/os/linux/x86_64</code></para>
+ </listitem>
+ </variablelist>
+ <para>Once you have navigated to the right directory, run the following command:</para>
+ <variablelist>
+ <listitem>
+ <para><code>./opxml info</code></para>
+ </listitem>
+ </variablelist>
+ <para>Check that the paths in the <code>defaults</code> section are correct. If the output is similar to the output of the command <code>ophelp</code>, but formatted as XML, then this might not be the problem. However, if running <code>opxml</code> produces an error, it may be the root cause. A common error on some systems is that they use an older version of the C runtime libraries (i.e. <code>glibc</code>). Refer to
+ <link linkend="Rebuilding_opxml">Rebuilding opxml</link> for a solution to this error.
+ </para>
+ <para>In any case, if there is an error please look for an
+ <ulink url="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&amp;short_desc_type=allwordssubstr&amp;short_desc=&amp;classification=Technology&amp;product=Linux+Tools&amp;component=OProfile&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=&amp;emailtype1=substring&amp;email1=&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">existing bug</ulink> or if one does not exist,
+ <ulink url="https://bugs.eclipse.org/bugs/enter_bug.cgi?assigned_to=ksebasti%40redhat.com&amp;blocked=&amp;bug_file_loc=http%3A%2F%2F&amp;bug_severity=normal&amp;bug_status=NEW&amp;comment=&amp;component=OProfile&amp;contenttypeentry=&amp;contenttypemethod=autodetect&amp;contenttypeselection=text%2Fplain&amp;data=&amp;dependson=&amp;description=&amp;flag_type-1=X&amp;flag_type-2=X&amp;flag_type-4=X&amp;flag_type-6=X&amp;flag_type-7=X&amp;flag_type-8=X&amp;form_name=enter_bug&amp;keywords=&amp;op_sys=Linux&amp;priority=P3&amp;product=Linux%20Tools&amp;qa_contact=&amp;rep_platform=PC&amp;short_desc=&amp;version=0.2">file a new bug</ulink>.
+ </para>
+ </section>
+ <section id="Rebuilding_opxml">
+ <title>Rebuilding opxml</title>
+ <para>You will need to rebuild the <code>opxml</code> binary if running it returns an error similar to the following:</para>
+ <variablelist>
+ <listitem>
+ <para><code>opxml: /some/path/libc.so.6: version `GLIBC_2.8' not found (required by opxml)</code></para>
+ </listitem>
+ </variablelist>
+ <para>
+ <emphasis role="bold">Warning:</emphasis> this is rarely necessary; in some cases, rebuilding the <code>opxml</code> binary may break an otherwise working OProfile plug-in installation. You should only rebuild the <code>opxml</code> binary if you are sure that doing so is the only remaining option in fixing the OProfile plug-in for Eclipse.
+ </para>
+ <para>To rebuild the <code>opxml</code> binary, perform the following steps</para>
+ <orderedlist>
+ <listitem>
+ <para>Follow the exact same steps as
+ <link linkend="Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</link>, except instead of changing to the <code>
+ <emphasis role="italic">natives/linux/scripts</emphasis></code> sub-directory, change to the <code>
+ <emphasis role="italic">natives/linux/opxml</emphasis></code> sub-directory of the core plugin. The source files for the <code>opxml</code> binary should be located here.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Rebuilding <code>opxml</code> requires <code>make</code>, <code>g++</code>, the <code>libbfd</code> libraries and the OProfile development libraries. In Fedora, the <code>oprofile-devel</code> package contains the OProfile development libraries; for information about the OProfile development libraries in Ubuntu, refer to
+ <link linkend="Ubuntu_-_Extra_Requirements">Ubuntu - Extra Requirements</link>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Run <code>make</code> to build the binary.</para>
+ </listitem>
+ <listitem>
+ <para>Run <code>make install</code> to install the binary into the correct plug-in directory.</para>
+ </listitem>
+ <listitem>
+ <para>Run <code>make clean</code> to remove the extra files created during the build process.</para>
+ </listitem>
+ </orderedlist>
+ <section id="Ubuntu_-_Extra_Requirements">
+ <title>Ubuntu - Extra Requirements</title>
+ <para>Ubuntu and other Debian-based systems do not provide the OProfile development libraries in their packaging management system, so we must build them by hand. To do so, perform the following steps:</para>
+ <orderedlist>
+ <listitem>
+ <para>Install the packages <code>binutils-dev</code> and <code>libpopt-dev</code>.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>sudo apt-get install binutils-dev libpopt-dev</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Download the OProfile source.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>apt-get source oprofile</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Unpack the OProfile source tarball.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>cd oprofile-0.9.3 ; tar -zxf oprofile_0.9.3-1.1ubuntu2.tar.gz</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Run the <code>configure</code> tool.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>cd oprofile-0.9.3 ; ./configure --without-kernel-support</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Compile the required libraries.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>make</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Move the libraries into the include path.</para>
+ <itemizedlist>
+ <listitem>
+ <para><code>sudo mv libutil/op_types.h libop/op_sample_file.h libutil/op_list.h libop/op_events.h libop/op_cpu_type.h libop/op_config.h libdb/odb.h /usr/include</code></para>
+ </listitem>
+ <listitem>
+ <para><code>sudo mv libop/libop.a libdb/libodb.a /usr/lib</code></para>
+ </listitem>
+ <listitem>
+ <para><code>sudo mv libabi/libabi.a /usr/lib/libopabi.a</code></para>
+ </listitem>
+ <listitem>
+ <para><code>sudo mv libutil/libutil.a /usr/lib/liboputil.a</code></para>
+ </listitem>
+ <listitem>
+ <para><code>sudo mv libutil++/libutil++.a /usr/lib/liboputil++.a</code></para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </orderedlist>
+ <para>The required libraries should now be in the proper place for compiling. Continue the steps in the
+ <link linkend="Rebuilding_opxml">Rebuilding opxml</link> section.
+ </para>
+ <para>
+ <emphasis role="bold">Note:</emphasis> The procedure for building the OProfile development libraries for Ubuntu (described in this section) was tested on Ubuntu 8.04 with Eclipse, the CDT, oprofile and all its dependencies already installed via <code>apt</code>.
+ </para>
+ </section>
+ </section>
+ </chapter>
+ <chapter id="Updating_This_Document">
+ <title>Updating This Document</title>
+ <para>This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
+
+ <ulink url="http://wiki.eclipse.org/Linux_Tools_Project/OProfile/User_Guide">http://wiki.eclipse.org/Linux_Tools_Project/OProfile/User_Guide</ulink>
+ </para>
+ </chapter>
+</book> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile-View.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile-View.html
new file mode 100644
index 0000000000..cc3596e88f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/OProfile-View.html
@@ -0,0 +1,148 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - OProfile View</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">OProfile View</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Profiling-Configuration.html" title="Profiling Configuration">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Example-Project.html" title="Example Project">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Profiling Configuration</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Example Project</td>
+ </tr>
+ </table><hr/>
+ <h1 id="OProfile_View">OProfile View</h1>
+ <p>The OProfile view is the central point of interaction of the plug-in with the results of profiling.</p>
+ <p>
+ <img border="0" src="images/Screenshot-oprofile_view_full.png"/>
+ </p>
+ <p>The tree structure displayed above describes one or more profiles of one or more events in the following manner:</p>
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_event.gif"/> Events -- the name of the profiling event used by OProfile (e.g. <code>CPU_CLK_UNHALTED</code>)
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_session.gif"/> Session -- the name of the session the profile is stored in (e.g. <code>run1</code>)
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_image.gif"/> Image -- the binary being profiled (e.g.
+ <i><code>/notnfs/ksebasti/oprofile/plugin/factorial/Debug/factorial</code></i>)
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_symbol.gif"/> Symbol -- symbols gathered from the binary's debug information (e.g. <code>factorial2</code>)
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_sample.gif"/> Sample -- individual OProfile samples correlated to line numbers of source code
+ </li>
+ </ul>
+ </li>
+ <li>
+ <img border="0" src="images/Icon-oprofile_dependent.gif"/> Dependent Images -- other binaries related to the run of the program; shared libraries or kernel modules
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_image.gif"/> Image -- the dependent binary
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_symbol.gif"/> Symbol -- same as above
+ <ul>
+ <li>
+ <img border="0" src="images/Icon-oprofile_sample.gif"/> Sample -- same as above
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ <p>If source code is not available, some symbols (including source file name) may be shown, but no samples. This is normally the case with programs that use shared libraries. Also, depending on the
+ <a href="Profiling-Configuration.html#Global_Settings">Global Settings</a>, a profile may have no dependent images.
+ </p>
+ <p>Note that after Eclipse is restarted, there will be no data shown in the OProfile view. Data from past profiles will still be on the system, if not touched otherwise, and can be re-read with the <u>Refresh View</u> menu action (refer to the
+ <a href="OProfile-View.html#View_Menu">View Menu</a> section for more details).
+ </p>
+ <h2 id="Features">Features</h2>
+ <p>This section describes the features of the plug-in exposed through the view.</p>
+ <h3 id="View_Tree">View Tree</h3>
+ <p>Double-clicking on a
+ <img border="0" src="images/Icon-oprofile_sample.gif"/>sample will open the source file in an editor and place the insertion point at the corresponding line in code.
+ </p>
+ <p>
+ <b>Note:</b> For this to work, the source code must be available and it must be in the correct directory (as described in the debug info of the binary).
+ </p>
+ <h3 id="View_Menu">View Menu</h3>
+ <dl>
+ <dt>Open OProfile Daemon Log</dt>
+ <dd>This will launch a dialog showing the contents of the OProfile daemon log.
+ <br/>
+ <img border="0" src="images/Screenshot-oprofiled_log_reader.png"/>
+ <br/>By default, the OProfile daemon log is in <code>
+ <i>/var/lib/oprofile/samples/oprofiled.log</i></code>
+ </dd>
+ </dl>
+ <dl>
+ <dt>Refresh View</dt>
+ <dd>This will re-read the OProfile data on the system, re-create the internal data model and re-display the profile tree. Doing so allows you to display data already on the system without launching a profile (e.g. when Eclipse first starts up).</dd>
+ </dl>
+ <dl>
+ <dt>Save Default Session</dt>
+ <dd>The default session, named <code>current</code>, is overwritten on each launch of a profile if it is not saved. If you wish to keep a profile for later viewing, this menu action will allow you to save the session to a different name.
+ <br/>Since the samples are in a system directory, this operation requires root privileges; hence, you will be prompted for the root password. The
+ <b>
+ <i>Save Session</i>
+ </b> dialog is shown below:
+ </dd>
+ </dl>
+ <p>
+ <img border="0" src="images/Screenshot-oprofile_save_session.png"/>
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Profiling-Configuration.html" title="Profiling Configuration">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="Example-Project.html" title="Example Project">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Profiling Configuration</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Example Project</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Profiling-Configuration.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Profiling-Configuration.html
new file mode 100644
index 0000000000..89fc38cb28
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Profiling-Configuration.html
@@ -0,0 +1,227 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Profiling Configuration</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Profiling Configuration</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Launching-A-Profile.html" title="Launching A Profile">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="OProfile-View.html" title="OProfile View">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Launching A Profile</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">OProfile View</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Profiling_Configuration">Profiling Configuration</h1>
+ <p>OProfile has many configuration options, the amount of which can be overwhelming. For more information about these options, refer to
+ <a href="http://oprofile.sourceforge.net/doc/controlling.html">http://oprofile.sourceforge.net/doc/controlling.html</a>. The
+ <b>
+ <i>Profile Configurations</i>
+ </b> menu provided by the OProfile plug-in aims to make relevant, commonly-used OProfile configuration options easily accessible to users of all experience levels. Currently, the
+ <b>
+ <i>Profile Configurations</i>
+ </b> menu provides two configuration tabs to the standard CDT launch configuration:
+ <a href="Profiling-Configuration.html#Global_Settings">Global Settings</a> and
+ <a href="Profiling-Configuration.html#Event_Configuration">Event Configuration</a>.
+ </p>
+ <h2 id="Global_Settings">Global Settings</h2>
+ <p>The
+ <b>
+ <i>Global Settings</i>
+ </b> tab configures how the OProfile daemon gathers profiling information. Each option is described below.
+
+ <img border="0" src="images/Screenshot-global_config.png"/>
+ </p>
+ <dl>
+ <dt>Kernel Image File (optional)</dt>
+ <dd>To collect more detailed information about the operation of a program in the Linux kernel, use the <u>Browse</u> button specify the location of your running kernel's
+ <i><code>vmlinux</code></i> file. A kernel's
+ <i><code>vmlinux</code></i> file contains debugging information required by OProfile. Note that the compressed
+ <i>vmlinux</i> file, often named
+ <i><code>vmlinuz</code></i>, cannot be used for this purpose.
+ <br/> Note: For this option to have any effect, you must enable the
+ <b>
+ <i>Include dependent kernel modules</i>
+ </b> option.
+ </dd>
+ </dl>
+ <dl>
+ <dt>Include dependent shared libraries</dt>
+ <dd>This option will make OProfile include samples from shared libraries that are used by the profiled binary/program. These samples will then be aggregated in the profile results.</dd>
+ </dl>
+ <dl>
+ <dt>Include dependent kernel modules</dt>
+ <dd>This option will make OProfile include samples related to running in the kernel. If the
+ <i><code>vmlinux</code></i> file is specified, the profile will include details of the specific kernel modules in use. Otherwise, kernel samples will be grouped under the name <code>no-vmlinux</code>.
+ </dd>
+ </dl>
+ <p>The differences between the options are illustrated in the following OProfile view screenshot:</p>
+ <p>
+ <img border="0" src="images/Screenshot-oprofile_global_differences.png"/>
+ </p>
+ <ul>
+ <li><code>incl_library</code> was run with only the
+ <b>
+ <i>Include dependent shared libraries</i>
+ </b> checked
+ </li>
+ <li><code>incl_vmlinux</code> was run with the
+ <i><code>vmlinux</code></i> file specified; both
+ <b>
+ <i>Include dependent shared libraries</i>
+ </b> and
+ <b>
+ <i>Include dependent kernel modules</i>
+ </b> checked
+ </li>
+ <li><code>no_vmlinux</code> was run without any
+ <i><code>vmlinux</code></i> file specified; both
+ <b>
+ <i>Include dependent shared libraries</i>
+ </b> and
+ <b>
+ <i>Include dependent kernel modules</i>
+ </b> checked
+ </li>
+ <li><code>novmlinux_noseparate</code> was run with none of the options checked</li>
+ </ul>
+ <h2 id="Event_Configuration">Event Configuration</h2>
+ <p>Your system processor's hardware profiling registers often contain a large number of options. The
+ <b>
+ <i>Event Configuration</i>
+ </b> tab condenses these options to a more manageable amount.
+ </p>
+ <h3 id="Timer_Interrupt_Mode">Timer Interrupt Mode</h3>
+ <p>If your processor (or kernel) does not support the hardware profiling registers OProfile uses, OProfile will run in
+ <i>timer-interrupt mode</i>. This mode has no user-configurable events. For more information about
+ <i>timer-interrupt mode</i>, refer to
+ <a href="http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer">http://oprofile.sourceforge.net/doc/detailed-parameters.html#timer</a>.
+ </p>
+ <p>The event configuration tab will then look like the screenshot below:</p>
+ <p>
+ <img border="0" src="images/Screenshot-oprofile_event_timer.png"/>
+ </p>
+ <h3 id="Regular_Mode">Regular Mode</h3>
+ <p>If your processor (or kernel) supports hardware profiling registers, there are several configuration options available to you. The availability of these configuration options depend on your processor model or kernel version. With proper support, the
+ <b>
+ <i>Events</i>
+ </b> configuration tab will look like the following screenshot:
+ </p>
+ <p>
+ <img border="0" src="images/Screenshot-oprofile_eventconfig.png"/>
+ </p>
+ <p>In
+ <i>regular mode</i>, the
+ <b>
+ <i>Events</i>
+ </b> configuration tab can contain any of the following options:
+ </p>
+ <dl>
+ <dt>Use default event</dt>
+ <dd>This option is enabled by default when creating a new profile configuration, or when a profile configuration is created through the
+ <a href="Launching-A-Profile.html#One-Click_Launch">one-click launch</a>.
+ <b>
+ <i>Use default event</i>
+ </b> is a shortcut to use an event based on processor execution time, with a reasonable value for the
+ <b>
+ <i>Count</i>
+ </b> option. Using this option will prevent you from configuring the counters any further.
+ <br/> For a list of default events for various processors, refer to
+ <a href="http://oprofile.sourceforge.net/doc/controlling.html#eventspec">http://oprofile.sourceforge.net/doc/controlling.html#eventspec</a>.
+ </dd>
+ </dl>
+ <dl>
+ <dt>Counter Tabs (
+ <b>
+ <i>Ctr 0</i>
+ </b>,
+ <b>
+ <i>Ctr 1</i>
+ </b>,
+ <b>
+ <i>Ctr 2</i>
+ </b>, and so on)
+ </dt>
+ <dd>A processor may have 1 to 8 hardware profiling registers (also called counters). Each one may be programmed separately to profile many events simultaneously. Each tabs labelled
+ <i>Ctr</i> represents one counter and exposes the same options.
+ </dd>
+ </dl>
+ <dl>
+ <dt>Enabled</dt>
+ <dd>This option (located in each counter tab) disables or enables a counter.</dd>
+ </dl>
+ <dl>
+ <dt>Event List</dt>
+ <dd>A list of the events available for profiling on a given counter.</dd>
+ </dl>
+ <dl>
+ <dt>Event Description</dt>
+ <dd>When you select an event from the events list, this field provides a short description of that event's function. OProfile provides the content for this field.</dd>
+ </dl>
+ <dl>
+ <dt>Profile Kernel and Profile user binaries</dt>
+ <dd>Instructs OProfile to profile binaries in the selected spaces. Keeping both checked is recommended (even if other
+ <a href="Profiling-Configuration.html#Global_Settings">Global Settings</a> are not specified).
+ </dd>
+ </dl>
+ <dl>
+ <dt>Count</dt>
+ <dd>Specifies a reset count for the hardware counter. In most cases, the default value (based on the CPU clock frequency) is sufficient. Each event has a minimum value, but it is recommended to use a value many orders of magnitude larger.
+ <br/>
+ <b>WARNING</b>: if you specify a value that is too low, the profiled program may take much longer to return or your system may hang.
+ </dd>
+ </dl>
+ <dl>
+ <dt>Unit Mask</dt>
+ <dd>Many events have a
+ <i>unit mask</i> which allows further narrowing of the scope of the event. If in doubt, use the default value (specified by OProfile). There are three types of unit masks:
+ </dd>
+ </dl>
+ <ul>
+ <li>Mandatory -- no selection necessary; a single required value</li>
+ <li>Exclusive -- several possible values; a single required value</li>
+ <li>Bitmask -- several possible values; a combination of several values</li>
+ </ul><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Launching-A-Profile.html" title="Launching A Profile">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="OProfile-View.html" title="OProfile View">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Launching A Profile</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">OProfile View</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Troubleshooting.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Troubleshooting.html
new file mode 100644
index 0000000000..c586dc5fca
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Troubleshooting.html
@@ -0,0 +1,278 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Troubleshooting</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Troubleshooting</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Example-Project.html" title="Example Project">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right">
+ <a href="Updating-This-Document.html" title="Updating This Document">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Example Project</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Updating This Document</td>
+ </tr>
+ </table><hr/>
+ <h1 id="Troubleshooting">Troubleshooting</h1>
+ <p>Various problems and their solutions are described here. If you encounter a problem not described here, please
+ <a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?assigned_to=ksebasti%40redhat.com&amp;blocked=&amp;bug_file_loc=http%3A%2F%2F&amp;bug_severity=normal&amp;bug_status=NEW&amp;comment=&amp;component=OProfile&amp;contenttypeentry=&amp;contenttypemethod=autodetect&amp;contenttypeselection=text%2Fplain&amp;data=&amp;dependson=&amp;description=&amp;flag_type-1=X&amp;flag_type-2=X&amp;flag_type-4=X&amp;flag_type-6=X&amp;flag_type-7=X&amp;flag_type-8=X&amp;form_name=enter_bug&amp;keywords=&amp;op_sys=Linux&amp;priority=P3&amp;product=Linux%20Tools&amp;qa_contact=&amp;rep_platform=PC&amp;short_desc=">file a bug</a>.
+ </p>
+ <h2 id="Install_Script_Errors">Install Script Errors</h2>
+ <p>This section describes different errors that could occur from running the install scripts (i.e. <code>
+ <i>install.sh</i></code> or <code>
+ <i>install-noconsolehelper.sh</i></code>)
+ </p>
+ <h3 id="Error:_script_must_be_run_as_the_root_user">Error: script must be run as the root user</h3>
+ <p>You attempted to run the script as an ordinary, non-root user. You must be the root user to run the install script, as the scripts edit files located in root-owned directories. </p>
+ <p>Solution: Run the command <code>su -</code> to become the root user, or run the script as the root user with <code>su -c './install.sh'</code>.</p>
+ <h3 id="Error:_script_must_be_run_with_pwd_in_script_dir">Error: script must be run with pwd in script dir</h3>
+ <p>Your current working directory must be the <code>
+ <i>natives/linux/scripts</i></code> subdirectory of the OProfile core plug-in; running the script relative from another location will not work.
+ </p>
+ <p>Solution: Simply follow the steps on
+ <a href="Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</a> to find the <code>
+ <i>natives/linux/scripts</i></code> subdirectory of the OProfile core plug-in.
+ </p>
+ <h3 id="Error:_required_binaries_do_not_exist.2C_OProfile_not_installed.3F">Error: required binaries do not exist, OProfile not installed?</h3>
+ <p>The OProfile plug-in could not find the <code>
+ <i>oprofiled</i></code> and <code>
+ <i>opcontrol</i></code> binaries. This could mean they are not in their default directory (<code>
+ <i>/usr/bin</i></code>), or they do not exist at all.
+ </p>
+ <p>Solution: If the binaries are on your system (and in your <code>PATH</code>) but not in those directories, you can either remove these checks from the install script or create symlinks in the <code>
+ <i>/usr/bin</i></code> directory. Of course, if the binaries do not exist on your system, then install the <code>
+ <i>oprofile</i></code> package.
+ </p>
+ <h3 id="Error:_.2Fusr.2Fbin.2Fconsolehelper_does_not_exist.2C_run_install-noconsolehelper.sh_instead">Error: /usr/bin/consolehelper does not exist, run install-noconsolehelper.sh instead</h3>
+ <p>You ran the <code>
+ <i>install.sh</i></code> script, but <code>consolehelper</code> was not installed on your system.
+ As described in
+ <a href="Installation-and-Set-Up.html#Step_2_-_Choose_Which_Installation_Script_To_Run">Step 2 - Choose Which Installation Script To Run</a>, if <code>consolehelper</code> is not installed, then you will need to use a root authentication mode that uses the <code>sudo</code> mechanism.
+ </p>
+ <p>Solution: Run the <code>
+ <i>install-noconsolehelper.sh</i></code> script instead.
+ </p>
+ <h3 id="Error:_cannot_create_opcontrol_wrapper_in_.3Cdirectory.3E">Error: cannot create opcontrol wrapper in &lt;directory></h3>
+ <p>The <code>ln</code> command reports that the symlink could not be created. This can occur if the <code>
+ <i>natives/linux/scripts</i></code> subdirectory is located on an NFS mount; the NFS server will not allow the local root user to create files in the directory.
+ </p>
+ <p>Solution: Before running the <code>
+ <i>install.sh</i></code> script, first create the symlink as a regular user by running the command <code>ln -s /usr/bin/consolehelper opcontrol</code>. Then, remove the following section from the <code>
+ <i>install.sh</i></code> script:
+ </p>
+ <pre>#create the sym link to consolehelper
+test -L ./opcontrol || { rm -f ./opcontrol &amp;&amp; ln -s /usr/bin/consolehelper opcontrol ; }
+if [ $? -ne 0 ]; then
+ echo Error: cannot create opcontrol wrapper in `pwd`
+ exit 1
+fi
+</pre>
+ <p>The <code>
+ <i>install.sh</i></code> script is fixed in the most recent version of the OProfile plug-in for Eclipse, but not in the 0.2.0 release.
+ </p>
+ <h3 id="Error:_cannot_find_opxml_binary.2C_required_plugin_missing">Error: cannot find opxml binary, required plugin missing</h3>
+ <p>This can occur if the native binary <code>
+ <i>opxml</i></code> is not found. This binary is required for proper operation of the plug-in.
+ </p>
+ <p>Solution: If the <code>
+ <i>org.eclipse.linuxtools.oprofile.core.linux.{x86,x86_64,ppc}</i></code> directories exist (in the Eclipse <code>
+ <i>plugins</i></code> directory), refer to the
+ <a href="Troubleshooting.html#Rebuilding_opxml">Rebuilding opxml</a> section for instructions on rebuilding the binary and placing it in the proper directory. Otherwise, re-install the plug-in.
+ </p>
+ <h2 id="No_Samples_From_A_Profile">No Samples From A Profile</h2>
+ <p>It is possible for a profile run of a program to return no samples, resulting in no <code>current</code> session displayed. This is not always indicative of a problem with either OProfile or the profiled program. OProfile is a system-wide profiling tool; hence, other active processes running on your system may overshadow your program. This is particularly true if the profiled program is not CPU intensive. </p>
+ <p>In addition, the
+ <i>Event</i> you choose (selected through the
+ <b>
+ <i>Events</i>
+ </b> tab, as described in
+ <a href="Profiling-Configuration.html#Regular_Mode">Regular Mode</a>) could cause a profile to return no samples; for example the event
+ <i>BR_CND_MISSP_EXEC</i> will only provide samples if a branch was mispredicted by the processor. Note also that due to the statistical nature of OProfile, profiling is neither deterministic nor consistent; two subsequent runs may output very different results. In some cases, one run can result in no samples, while another run on the same program can result in many samples. The OProfile online documentation has other useful information
+ <a href="http://oprofile.sourceforge.net/doc/results.html#no-results">here</a>.
+ </p>
+ <p>Solution: The following suggestions could help you generate more samples from a profile run:</p>
+ <ul>
+ <li>run your program with a larger input</li>
+ <li>halt or kill as many other non-essential processes as possible </li>
+ <li>reduce the
+ <i>Count</i> in the
+ <a href="Profiling-Configuration.html#Event_Configuration">Event Configuration</a> tab
+ </li>
+ <li>launch a profile several times </li>
+ </ul>
+ <p>If you are unsure whether your configuration is working correctly, try profiling the sample project in the
+ <a href="Example-Project.html#Example_Project">Example Project</a> section.
+ </p>
+ <h2 id="Log_Reader_Hangs">Log Reader Hangs</h2>
+ <p>If the OProfile daemon log file is too large, the log reader may hang and possibly cause the OProfile plug-in to crash. This occurs when the
+ <i>verbosity</i> option is set to <code>all</code>, which results in several hundred MiB of text in the log over several profile runs. If you do require all this data in the log file, do not launch the log reader. Delete or backup the log file before running the log reader again.
+ </p>
+ <h2 id="Errors_Related_to_opxml">Errors Related to opxml</h2>
+ <p><code>opxml</code> is the native program that bridges OProfile and the OProfile plug-in for Eclipse. In some cases, some errors may be caused by problems with <code>opxml</code>. To verify if this is the case, run <code>opxml</code>.</p>
+ <p><code>opxml</code> is normally located in the Eclipse <code>
+ <i>plugins</i></code> directory, similar to the install scripts described in
+ <a href="Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</a>. However, depending on your platform, the location of <code>opxml</code> will be different. To determine what your platform is, run the following command at a terminal:
+ </p>
+ <dl>
+ <dd>
+ <dl>
+ <dd><code>uname -m</code></dd>
+ </dl>
+ </dd>
+ </dl>
+ <p>Depending on the output, locate the following directory in the same manner as
+ <a href="Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</a>, and change into that directory:
+ </p>
+ <table border="1">
+ <tr>
+ <th>Output from <code>uname -m</code></th>
+ <th>Directory to use in <code>find</code> command</th>
+ <th>Sub-directory to change to</th>
+ </tr>
+ <tr>
+ <td>i386, i468, i568, i686, x86</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.x86</td>
+ <td>os/linux/x86</td>
+ </tr>
+ <tr>
+ <td>x86_64</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.x86_64</td>
+ <td>os/linux/x86_64</td>
+ </tr>
+ <tr>
+ <td>ppc, ppc64</td>
+ <td>org.eclipse.linuxtools.oprofile.core.linux.ppc</td>
+ <td>os/linux/ppc</td>
+ </tr>
+ </table>
+ <p>For example, if you are running Eclipse on a 64bit machine (i.e. x86_64), you should run the following command to find the location of <code>opxml</code>:</p>
+ <dl>
+ <dd><code>$ find /home/ksebasti/eclipse -name 'org.eclipse.linuxtools.oprofile.core.linux.x86_64_*'</code></dd>
+ </dl>
+ <p>This will display the following output (or similar):</p>
+ <dl>
+ <dd><code>/home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core.linux.x86_64_0.2.0.200904201514</code></dd>
+ </dl>
+ <p>Navigate into that directory:</p>
+ <dl>
+ <dd><code>$ cd /home/ksebasti/eclipse/plugins/org.eclipse.linuxtools.oprofile.core.linux.x86_64_0.2.0.200904201514/os/linux/x86_64</code></dd>
+ </dl>
+ <p>Once you have navigated to the right directory, run the following command:</p>
+ <dl>
+ <dd><code>./opxml info</code></dd>
+ </dl>
+ <p>Check that the paths in the <code>defaults</code> section are correct. If the output is similar to the output of the command <code>ophelp</code>, but formatted as XML, then this might not be the problem. However, if running <code>opxml</code> produces an error, it may be the root cause. A common error on some systems is that they use an older version of the C runtime libraries (i.e. <code>glibc</code>). Refer to
+ <a href="Troubleshooting.html#Rebuilding_opxml">Rebuilding opxml</a> for a solution to this error.
+ </p>
+ <p>In any case, if there is an error please look for an
+ <a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&amp;short_desc_type=allwordssubstr&amp;short_desc=&amp;classification=Technology&amp;product=Linux+Tools&amp;component=OProfile&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=&amp;emailtype1=substring&amp;email1=&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">existing bug</a> or if one does not exist,
+ <a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?assigned_to=ksebasti%40redhat.com&amp;blocked=&amp;bug_file_loc=http%3A%2F%2F&amp;bug_severity=normal&amp;bug_status=NEW&amp;comment=&amp;component=OProfile&amp;contenttypeentry=&amp;contenttypemethod=autodetect&amp;contenttypeselection=text%2Fplain&amp;data=&amp;dependson=&amp;description=&amp;flag_type-1=X&amp;flag_type-2=X&amp;flag_type-4=X&amp;flag_type-6=X&amp;flag_type-7=X&amp;flag_type-8=X&amp;form_name=enter_bug&amp;keywords=&amp;op_sys=Linux&amp;priority=P3&amp;product=Linux%20Tools&amp;qa_contact=&amp;rep_platform=PC&amp;short_desc=&amp;version=0.2">file a new bug</a>.
+ </p>
+ <h2 id="Rebuilding_opxml">Rebuilding opxml</h2>
+ <p>You will need to rebuild the <code>opxml</code> binary if running it returns an error similar to the following:</p>
+ <dl>
+ <dd><code>opxml: /some/path/libc.so.6: version `GLIBC_2.8' not found (required by opxml)</code></dd>
+ </dl>
+ <p>
+ <b>Warning:</b> this is rarely necessary; in some cases, rebuilding the <code>opxml</code> binary may break an otherwise working OProfile plug-in installation. You should only rebuild the <code>opxml</code> binary if you are sure that doing so is the only remaining option in fixing the OProfile plug-in for Eclipse.
+ </p>
+ <p>To rebuild the <code>opxml</code> binary, perform the following steps</p>
+ <ol>
+ <li>Follow the exact same steps as
+ <a href="Installation-and-Set-Up.html#Step_1_-_Locate_the_Installation_Scripts">Step 1 - Locate the Installation Scripts</a>, except instead of changing to the <code>
+ <i>natives/linux/scripts</i></code> sub-directory, change to the <code>
+ <i>natives/linux/opxml</i></code> sub-directory of the core plugin. The source files for the <code>opxml</code> binary should be located here.
+ </li>
+ <li>Rebuilding <code>opxml</code> requires <code>make</code>, <code>g++</code>, the <code>libbfd</code> libraries and the OProfile development libraries. In Fedora, the <code>oprofile-devel</code> package contains the OProfile development libraries; for information about the OProfile development libraries in Ubuntu, refer to
+ <a href="Troubleshooting.html#Ubuntu_-_Extra_Requirements">Ubuntu - Extra Requirements</a>.
+ </li>
+ <li>Run <code>make</code> to build the binary.</li>
+ <li>Run <code>make install</code> to install the binary into the correct plug-in directory.</li>
+ <li>Run <code>make clean</code> to remove the extra files created during the build process.</li>
+ </ol>
+ <h3 id="Ubuntu_-_Extra_Requirements">Ubuntu - Extra Requirements</h3>
+ <p>Ubuntu and other Debian-based systems do not provide the OProfile development libraries in their packaging management system, so we must build them by hand. To do so, perform the following steps:</p>
+ <ol>
+ <li>Install the packages <code>binutils-dev</code> and <code>libpopt-dev</code>.
+ <ul>
+ <li><code>sudo apt-get install binutils-dev libpopt-dev</code></li>
+ </ul>
+ </li>
+ <li>Download the OProfile source.
+ <ul>
+ <li><code>apt-get source oprofile</code></li>
+ </ul>
+ </li>
+ <li>Unpack the OProfile source tarball.
+ <ul>
+ <li><code>cd oprofile-0.9.3 ; tar -zxf oprofile_0.9.3-1.1ubuntu2.tar.gz</code></li>
+ </ul>
+ </li>
+ <li>Run the <code>configure</code> tool.
+ <ul>
+ <li><code>cd oprofile-0.9.3 ; ./configure --without-kernel-support</code></li>
+ </ul>
+ </li>
+ <li>Compile the required libraries.
+ <ul>
+ <li><code>make</code></li>
+ </ul>
+ </li>
+ <li>Move the libraries into the include path.
+ <ul>
+ <li><code>sudo mv libutil/op_types.h libop/op_sample_file.h libutil/op_list.h libop/op_events.h libop/op_cpu_type.h libop/op_config.h libdb/odb.h /usr/include</code></li>
+ <li><code>sudo mv libop/libop.a libdb/libodb.a /usr/lib</code></li>
+ <li><code>sudo mv libabi/libabi.a /usr/lib/libopabi.a</code></li>
+ <li><code>sudo mv libutil/libutil.a /usr/lib/liboputil.a</code></li>
+ <li><code>sudo mv libutil++/libutil++.a /usr/lib/liboputil++.a</code></li>
+ </ul>
+ </li>
+ </ol>
+ <p>The required libraries should now be in the proper place for compiling. Continue the steps in the
+ <a href="Troubleshooting.html#Rebuilding_opxml">Rebuilding opxml</a> section.
+ </p>
+ <p>
+ <b>Note:</b> The procedure for building the OProfile development libraries for Ubuntu (described in this section) was tested on Ubuntu 8.04 with Eclipse, the CDT, oprofile and all its dependencies already installed via <code>apt</code>.
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Example-Project.html" title="Example Project">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right">
+ <a href="Updating-This-Document.html" title="Updating This Document">
+ <img alt="Next" border="0" src="images/images/next.gif"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Example Project</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top">Updating This Document</td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Updating-This-Document.html b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Updating-This-Document.html
new file mode 100644
index 0000000000..cf743c8943
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/Updating-This-Document.html
@@ -0,0 +1,54 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>OProfile Reference - Updating This Document</title>
+ <link type="text/css" rel="stylesheet" href="book.css"/>
+ </head>
+ <body>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <th style="width: 100%" align="center" colspan="3">Updating This Document</th>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Troubleshooting.html" title="Troubleshooting">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right"></td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Troubleshooting</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top"></td>
+ </tr>
+ </table><hr/>
+ <h1 id="Updating_This_Document">Updating This Document</h1>
+ <p>This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit
+
+ <a href="http://wiki.eclipse.org/Linux_Tools_Project/OProfile/User_Guide">http://wiki.eclipse.org/Linux_Tools_Project/OProfile/User_Guide</a>
+ </p><hr/>
+ <table class="navigation" style="width: 100%;" border="0" summary="navigation">
+ <tr>
+ <td style="width: 20%" align="left">
+ <a href="Troubleshooting.html" title="Troubleshooting">
+ <img alt="Previous" border="0" src="images/images/prev.gif"/>
+ </a>
+ </td>
+ <td style="width: 60%" align="center">
+ <a href="OProfile Reference.html" title="OProfile Reference">
+ <img alt="OProfile Reference" border="0" src="images/images/home.gif"/>
+ </a>
+ </td>
+ <td style="width: 20%" align="right"></td>
+ </tr>
+ <tr>
+ <td style="width: 20%" align="left" valign="top">Troubleshooting</td>
+ <td style="width: 60%" align="center"></td>
+ <td style="width: 20%" align="right" valign="top"></td>
+ </tr>
+ </table>
+ </body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_dependent.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_dependent.gif
new file mode 100644
index 0000000000..122bada5ff
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_dependent.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_event.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_event.gif
new file mode 100644
index 0000000000..c91f254ab1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_event.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_image.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_image.gif
new file mode 100644
index 0000000000..8aa0162df0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_image.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_sample.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_sample.gif
new file mode 100644
index 0000000000..061161ae1c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_sample.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_session.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_session.gif
new file mode 100644
index 0000000000..c2b41bda92
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_session.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_symbol.gif b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_symbol.gif
new file mode 100644
index 0000000000..6ae4604cdb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Icon-oprofile_symbol.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/LinuxTools-0.2.0-OProfile-Screenshot.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/LinuxTools-0.2.0-OProfile-Screenshot.png
new file mode 100644
index 0000000000..947b24ea5d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/LinuxTools-0.2.0-OProfile-Screenshot.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_dialog.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_dialog.png
new file mode 100644
index 0000000000..b9232e3dfe
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_dialog.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_shortcut.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_shortcut.png
new file mode 100644
index 0000000000..3ff8c3d530
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Oprofile_manual_shortcut.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-global_config.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-global_config.png
new file mode 100644
index 0000000000..af97846ec9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-global_config.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-installscript_error_dialog.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-installscript_error_dialog.png
new file mode 100644
index 0000000000..3dea3b95a6
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-installscript_error_dialog.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-one-click_launch.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-one-click_launch.png
new file mode 100644
index 0000000000..d55d704b4d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-one-click_launch.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-opcontrol_consolehelper.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-opcontrol_consolehelper.png
new file mode 100644
index 0000000000..5b2bc10372
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-opcontrol_consolehelper.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_event_timer.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_event_timer.png
new file mode 100644
index 0000000000..37b3e82405
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_event_timer.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_eventconfig.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_eventconfig.png
new file mode 100644
index 0000000000..d0bc0b627b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_eventconfig.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_global_differences.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_global_differences.png
new file mode 100644
index 0000000000..5d7cd3717e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_global_differences.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_save_session.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_save_session.png
new file mode 100644
index 0000000000..afb189b604
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_save_session.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_view_full.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_view_full.png
new file mode 100644
index 0000000000..6008028e64
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofile_view_full.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofiled_log_reader.png b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofiled_log_reader.png
new file mode 100644
index 0000000000..5a7f61ef88
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.doc/userguide/images/Screenshot-oprofiled_log_reader.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.project b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.project
new file mode 100644
index 0000000000..a5702a738c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.launch.tests</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..b8349f171f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Tue Mar 17 15:14:26 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d6e911a5cf
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.launch.tests
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.oprofile.launch.tests.LaunchTestsPlugin
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.4.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: junit.framework;version="4.7.0",
+ org.eclipse.cdt.core.model,
+ org.eclipse.cdt.launch,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
+ org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.daemon,
+ org.eclipse.linuxtools.oprofile.launch,
+ org.eclipse.linuxtools.oprofile.launch.configuration,
+ org.eclipse.linuxtools.oprofile.launch.launching,
+ org.eclipse.linuxtools.profiling.tests,
+ org.eclipse.swt,
+ org.eclipse.swt.layout,
+ org.eclipse.swt.widgets
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/build.properties
new file mode 100644
index 0000000000..0e80561916
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/build.properties
@@ -0,0 +1,13 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ test.xml,\
+ resources/
+src.includes = META-INF/,\
+ plugin.properties,\
+ src/,\
+ test.xml,\
+ resources/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/plugin.properties
new file mode 100644
index 0000000000..1d099e594c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/plugin.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# Copyright (c) 2009 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Ui Tests Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.cproject b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.cproject
new file mode 100644
index 0000000000..189e0592c1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.cproject
@@ -0,0 +1,593 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.403427377">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.403427377" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="primeTest" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.403427377" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.403427377." name="/" resourcePath="">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.558427244" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1359199583" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+<builder buildPath="${workspace_loc:/primeTest/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.586737917" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+<tool id="cdt.managedbuild.tool.gnu.archiver.base.2089156823" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.838879119" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.2129883685" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.900612275" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.890848790" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1566991183" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
+<option id="gnu.c.compiler.exe.debug.option.debugging.level.733038562" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.582042928" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1103748863" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug">
+<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.720696663" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+</inputType>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1031198340" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"/>
+<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.711744790" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1029709722" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.403427377;cdt.managedbuild.config.gnu.exe.debug.403427377.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.890848790;cdt.managedbuild.tool.gnu.c.compiler.input.582042928">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.24056498;cdt.managedbuild.config.gnu.exe.release.24056498.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1686021986;cdt.managedbuild.tool.gnu.c.compiler.input.1357248577">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.24056498">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.24056498" moduleId="org.eclipse.cdt.core.settings" name="Release">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="primeTest" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.24056498" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+<folderInfo id="cdt.managedbuild.config.gnu.exe.release.24056498." name="/" resourcePath="">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.247847873" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.2144033541" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+<builder buildPath="${workspace_loc:/primeTest/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.1815603600" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+<tool id="cdt.managedbuild.tool.gnu.archiver.base.514329033" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.732737648" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1782789072" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+<option id="gnu.cpp.compiler.exe.release.option.debugging.level.883245152" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1686021986" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1286291976" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
+<option id="gnu.c.compiler.exe.release.option.debugging.level.74557006" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1357248577" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1980307205" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release">
+<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1094559692" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+</inputType>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.906024509" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/>
+<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1057582725" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+<inputType id="cdt.managedbuild.tool.gnu.assembler.input.592314293" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.403427377;cdt.managedbuild.config.gnu.exe.debug.403427377.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.890848790;cdt.managedbuild.tool.gnu.c.compiler.input.582042928">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.24056498;cdt.managedbuild.config.gnu.exe.release.24056498.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1686021986;cdt.managedbuild.tool.gnu.c.compiler.input.1357248577">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<project id="primeTest.cdt.managedbuild.target.gnu.exe.2060231390" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+</storageModule>
+</cproject>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.project b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.project
new file mode 100644
index 0000000000..bcbd6b7b3c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/.project
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>primeTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>?name?</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildArguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildLocation</key>
+ <value>${workspace_loc:/primeTest/Debug}</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.contents</key>
+ <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/primeTest.c b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/primeTest.c
new file mode 100644
index 0000000000..df4f802a0b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/primeTest/primeTest.c
@@ -0,0 +1,36 @@
+void
+PrimeFactors(int n)
+{
+ int count = 0;
+ int temp = 0;
+ int i = 0;
+ for (i = 1; i <= n; i++)
+ {
+ int j = i - 1;
+ while (j > 1)
+ {
+ if (i % j == 0) //Is PRIME
+ break;
+ else
+ j--;
+ }
+
+ if (j == 1)
+ {
+ if (n % i == 0)
+ {
+ if (i > temp)
+ temp = i;
+ count++;
+ }
+ }
+ }
+}
+
+int
+main()
+{
+ int a = 35324;
+ PrimeFactors(a);
+ return 0;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.cproject b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.cproject
new file mode 100644
index 0000000000..cd18366c9c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.cproject
@@ -0,0 +1,593 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1175678966">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1175678966" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="sleepTest" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1175678966" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1175678966." name="/" resourcePath="">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1707235535" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1214447499" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+<builder buildPath="${workspace_loc:/sleepTest/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.1027550092" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+<tool id="cdt.managedbuild.tool.gnu.archiver.base.1529643871" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.339425130" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1980513678" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.587285095" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1711527348" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.948398850" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
+<option id="gnu.c.compiler.exe.debug.option.debugging.level.1175577535" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1219179977" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.546839158" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug">
+<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1380471818" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+</inputType>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1493322213" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug"/>
+<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1271920137" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+<inputType id="cdt.managedbuild.tool.gnu.assembler.input.2029809829" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1894586679;cdt.managedbuild.config.gnu.exe.release.1894586679.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1456980182;cdt.managedbuild.tool.gnu.c.compiler.input.1930258097">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1175678966;cdt.managedbuild.config.gnu.exe.debug.1175678966.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1711527348;cdt.managedbuild.tool.gnu.c.compiler.input.1219179977">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1894586679">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1894586679" moduleId="org.eclipse.cdt.core.settings" name="Release">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="sleepTest" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1894586679" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+<folderInfo id="cdt.managedbuild.config.gnu.exe.release.1894586679." name="/" resourcePath="">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1335316415" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1056384912" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+<builder buildPath="${workspace_loc:/sleepTest/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.1890388296" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+<tool id="cdt.managedbuild.tool.gnu.archiver.base.1599654641" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.110695799" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+<option id="gnu.cpp.compiler.exe.release.option.optimization.level.483218288" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+<option id="gnu.cpp.compiler.exe.release.option.debugging.level.1740548907" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1456980182" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.564508580" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
+<option id="gnu.c.compiler.exe.release.option.debugging.level.216318945" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1930258097" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1609842259" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release">
+<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1263392915" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+</inputType>
+</tool>
+<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1176128340" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release"/>
+<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1836498428" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1282718375" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1894586679;cdt.managedbuild.config.gnu.exe.release.1894586679.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1456980182;cdt.managedbuild.tool.gnu.c.compiler.input.1930258097">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1175678966;cdt.managedbuild.config.gnu.exe.debug.1175678966.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1711527348;cdt.managedbuild.tool.gnu.c.compiler.input.1219179977">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+</cconfiguration>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<project id="sleepTest.cdt.managedbuild.target.gnu.exe.918644780" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+</storageModule>
+</cproject>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.project b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.project
new file mode 100644
index 0000000000..8e8d33630c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/.project
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>sleepTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>?name?</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildArguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildLocation</key>
+ <value>${workspace_loc:/sleepTest/Debug}</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.contents</key>
+ <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/sleepTest.c b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/sleepTest.c
new file mode 100644
index 0000000000..e13b08b066
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/resources/sleepTest/sleepTest.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+
+int main() {
+ sleep(10);
+ return 0;
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/AllLaunchTests.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/AllLaunchTests.java
new file mode 100644
index 0000000000..31090113b8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/AllLaunchTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllLaunchTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.eclipse.linuxtools.oprofile.launch.tests"); //$NON-NLS-1$
+
+ if (LaunchTestsPlugin.RUN_OPROFILE) {
+ suite.addTestSuite(TestLaunching.class);
+ suite.addTestSuite(TestManualLaunching.class);
+ suite.addTestSuite(TestSetup.class);
+ }
+
+ suite.addTestSuite(TestDummy.class);
+
+ return suite;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/LaunchTestsPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/LaunchTestsPlugin.java
new file mode 100644
index 0000000000..de4451819a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/LaunchTestsPlugin.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class LaunchTestsPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.launch.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static LaunchTestsPlugin plugin;
+
+ /**
+ * Java system properties.
+ * usage: -Dorg.eclipse.linuxtools.oprofile.launch.tests.runOprofile=<yes|no> [default: yes]
+ * if yes, will run the launch tests
+ * no, will skip the launch tests (they all require oprofile to be set up)
+ */
+ public static final String SYSTEM_PROPERTY_RUN_OPROFILE = "org.eclipse.linuxtools.oprofile.launch.tests.runOprofile"; //$NON-NLS-1$
+ public static final boolean RUN_OPROFILE = System.getProperty(SYSTEM_PROPERTY_RUN_OPROFILE, "yes").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ /**
+ * The constructor
+ */
+ public LaunchTestsPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ 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)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static LaunchTestsPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestDummy.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestDummy.java
new file mode 100644
index 0000000000..82e95fd4e9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestDummy.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import junit.framework.TestCase;
+
+// Dummy test just so that the launch tests have something
+// running when oprofile does not
+public class TestDummy extends TestCase {
+ public void testPass() {
+ assertTrue(true);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestLaunching.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestLaunching.java
new file mode 100644
index 0000000000..daad08438b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestLaunching.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.Launch;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileEventConfigTab;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileSetupTab;
+import org.eclipse.linuxtools.oprofile.launch.launching.OprofileLaunchConfigurationDelegate;
+import org.eclipse.linuxtools.profiling.tests.AbstractTest;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class TestLaunching extends AbstractTest {
+ private class testingOprofileLaunchConfigurationDelegate extends OprofileLaunchConfigurationDelegate {
+ public boolean eventsIsNull;
+ public OprofileDaemonOptions _options;
+ protected void oprofileDumpSamples() { return; }
+ protected void oprofileReset() { return; }
+ protected void oprofileShutdown() { return; }
+ protected void oprofileStartCollection() { return; }
+ protected void oprofileSetupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) {
+ _options = options;
+ eventsIsNull = events == null ? true : false;
+ return;
+ }
+ @Override
+ protected void postExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents, ILaunch launch, Process process) {
+ super.postExec(options, daemonEvents, launch, process);
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected ILaunchConfiguration config;
+ protected Shell testShell;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ proj = createProjectAndBuild(LaunchTestsPlugin.getDefault().getBundle(), "primeTest"); //$NON-NLS-1$
+ config = createConfiguration(proj.getProject());
+ testShell = new Shell(Display.getDefault());
+ testShell.setLayout(new GridLayout());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ testShell.dispose();
+ deleteProject(proj);
+ super.tearDown();
+ }
+
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(OprofileLaunchPlugin.ID_LAUNCH_PROFILE);
+ }
+
+ @Override
+ protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
+ OprofileEventConfigTab configTab = new OprofileEventConfigTab();
+ OprofileSetupTab setupTab = new OprofileSetupTab();
+ configTab.setDefaults(wc);
+ setupTab.setDefaults(wc);
+ }
+
+ public void testDefaultLaunch() throws CoreException {
+ testingOprofileLaunchConfigurationDelegate delegate = new testingOprofileLaunchConfigurationDelegate();
+ ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
+
+ LaunchOptions options = new LaunchOptions();
+ options.loadConfiguration(config);
+ assertTrue(options.isValid());
+ assertEquals("", options.getBinaryImage()); //$NON-NLS-1$
+ assertEquals("", options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
+
+ delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
+ assertTrue(delegate.eventsIsNull);
+ assertNotNull(delegate._options);
+ assertTrue(delegate._options.getBinaryImage().length() > 0);
+ assertEquals("", delegate._options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(0, delegate._options.getCallgraphDepth());
+ assertFalse(delegate._options.getVerboseLogging());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, delegate._options.getSeparateProfilesMask());
+ }
+
+ public void testEventLaunch() throws CoreException {
+ testingOprofileLaunchConfigurationDelegate delegate = new testingOprofileLaunchConfigurationDelegate();
+ ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
+
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_COUNT(0), 100000);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_EVENT(0), "FAKE_EVENT"); //$NON-NLS-1$
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(0), 0);
+ wc.doSave();
+ LaunchOptions options = new LaunchOptions();
+ options.loadConfiguration(config);
+ assertTrue(options.isValid());
+ assertEquals("", options.getBinaryImage()); //$NON-NLS-1$
+ assertEquals("", options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
+
+ delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
+ assertFalse(delegate.eventsIsNull);
+ assertNotNull(delegate._options);
+ assertTrue(delegate._options.getBinaryImage().length() > 0);
+ assertEquals("", delegate._options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(0, delegate._options.getCallgraphDepth());
+ assertFalse(delegate._options.getVerboseLogging());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, delegate._options.getSeparateProfilesMask());
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestManualLaunching.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestManualLaunching.java
new file mode 100644
index 0000000000..2f50bd3a65
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestManualLaunching.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.Launch;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileEventConfigTab;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileSetupTab;
+import org.eclipse.linuxtools.oprofile.launch.launching.OprofileManualLaunchConfigurationDelegate;
+import org.eclipse.linuxtools.profiling.tests.AbstractTest;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class TestManualLaunching extends AbstractTest {
+ private class testingOprofileLaunchConfigurationDelegate extends OprofileManualLaunchConfigurationDelegate {
+ public boolean eventsIsNull;
+ public OprofileDaemonOptions _options;
+ protected void oprofileDumpSamples() { return; }
+ protected void oprofileReset() { return; }
+ protected void oprofileShutdown() { return; }
+ protected void oprofileStartCollection() { return; }
+ protected void oprofileSetupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) {
+ _options = options;
+ eventsIsNull = events == null ? true : false;
+ return;
+ }
+ @Override
+ protected void postExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents, ILaunch launch, Process process) {
+ super.postExec(options, daemonEvents, launch, process);
+
+ try {
+ process.waitFor();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected ILaunchConfiguration config;
+ protected Shell testShell;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ proj = createProjectAndBuild(LaunchTestsPlugin.getDefault().getBundle(), "sleepTest"); //$NON-NLS-1$
+ config = createConfiguration(proj.getProject());
+ testShell = new Shell(Display.getDefault());
+ testShell.setLayout(new GridLayout());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ testShell.dispose();
+ deleteProject(proj);
+ super.tearDown();
+ }
+
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(OprofileLaunchPlugin.ID_LAUNCH_PROFILE_MANUAL);
+ }
+
+ @Override
+ protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
+ OprofileEventConfigTab configTab = new OprofileEventConfigTab();
+ OprofileSetupTab setupTab = new OprofileSetupTab();
+ configTab.setDefaults(wc);
+ setupTab.setDefaults(wc);
+ }
+
+ public void testDefaultLaunch() throws CoreException {
+ testingOprofileLaunchConfigurationDelegate delegate = new testingOprofileLaunchConfigurationDelegate();
+ ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
+
+ LaunchOptions options = new LaunchOptions();
+ options.loadConfiguration(config);
+ assertTrue(options.isValid());
+ assertEquals("", options.getBinaryImage()); //$NON-NLS-1$
+ assertEquals("", options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
+
+ delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
+ assertTrue(delegate.eventsIsNull);
+ assertNotNull(delegate._options);
+ assertTrue(delegate._options.getBinaryImage().length() > 0);
+ assertEquals("", delegate._options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(0, delegate._options.getCallgraphDepth());
+ assertFalse(delegate._options.getVerboseLogging());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, delegate._options.getSeparateProfilesMask());
+ }
+
+ public void testEventLaunch() throws CoreException {
+ testingOprofileLaunchConfigurationDelegate delegate = new testingOprofileLaunchConfigurationDelegate();
+ ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
+
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_COUNT(0), 100000);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_EVENT(0), "FAKE_EVENT"); //$NON-NLS-1$
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(0), true);
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(0), 0);
+ wc.doSave();
+ LaunchOptions options = new LaunchOptions();
+ options.loadConfiguration(config);
+ assertTrue(options.isValid());
+ assertEquals("", options.getBinaryImage()); //$NON-NLS-1$
+ assertEquals("", options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, options.getSeparateSamples());
+
+ delegate.launch(config, ILaunchManager.PROFILE_MODE, launch, null);
+ assertFalse(delegate.eventsIsNull);
+ assertNotNull(delegate._options);
+ assertTrue(delegate._options.getBinaryImage().length() > 0);
+ assertEquals("", delegate._options.getKernelImageFile()); //$NON-NLS-1$
+ assertEquals(0, delegate._options.getCallgraphDepth());
+ assertFalse(delegate._options.getVerboseLogging());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, delegate._options.getSeparateProfilesMask());
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestSetup.java b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestSetup.java
new file mode 100644
index 0000000000..3baa987f61
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/src/org/eclipse/linuxtools/oprofile/launch/tests/TestSetup.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.tests;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileEventConfigTab;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileSetupTab;
+import org.eclipse.linuxtools.profiling.tests.AbstractTest;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class TestSetup extends AbstractTest {
+ protected ILaunchConfiguration config;
+ protected Shell testShell;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ proj = createProjectAndBuild(LaunchTestsPlugin.getDefault().getBundle(), "primeTest"); //$NON-NLS-1$
+ config = createConfiguration(proj.getProject());
+ testShell = new Shell(Display.getDefault());
+ testShell.setLayout(new GridLayout());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ testShell.dispose();
+ deleteProject(proj);
+ super.tearDown();
+ }
+
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(OprofileLaunchPlugin.ID_LAUNCH_PROFILE_MANUAL);
+ }
+
+ @Override
+ protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
+ OprofileEventConfigTab configTab = new OprofileEventConfigTab();
+ OprofileSetupTab setupTab = new OprofileSetupTab();
+ configTab.setDefaults(wc);
+ setupTab.setDefaults(wc);
+ }
+
+ //getter functions for otherwise unaccessible member variables
+ private class OprofileTestingSetupTab extends OprofileSetupTab {
+ protected Button getKernelCheck() { return _checkSeparateKernel; }
+ protected Button getLibraryCheck() { return _checkSeparateLibrary; }
+ protected Text getTextKernelImage() { return _kernelImageFileText; }
+ }
+
+ public void testSetupTab() throws CoreException {
+ OprofileTestingSetupTab tab = new OprofileTestingSetupTab();
+ tab.createControl(new Shell());
+ assertNotNull(tab.getImage());
+ assertNotNull(tab.getName());
+
+ //default config
+ tab.setDefaults(config.getWorkingCopy());
+ tab.initializeFrom(config);
+
+ Button libraryCheck = tab.getLibraryCheck();
+ libraryCheck.setSelection(true);
+ libraryCheck.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertEquals(OprofileDaemonOptions.SEPARATE_LIBRARY, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
+ libraryCheck.setSelection(false);
+ libraryCheck.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
+
+ Button kernelCheck = tab.getKernelCheck();
+ kernelCheck.setSelection(true);
+ kernelCheck.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertEquals(OprofileDaemonOptions.SEPARATE_KERNEL, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
+ kernelCheck.setSelection(false);
+ kernelCheck.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertEquals(OprofileDaemonOptions.SEPARATE_NONE, config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, -1));
+
+ libraryCheck.setSelection(true);
+ libraryCheck.notifyListeners(SWT.Selection, null);
+ kernelCheck.setSelection(true);
+ kernelCheck.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ tab.initializeFrom(config);
+ assertTrue(libraryCheck.getSelection());
+ assertTrue(kernelCheck.getSelection());
+
+ Text kernelLocationText = tab.getTextKernelImage();
+ kernelLocationText.setText("doesntexist"); //$NON-NLS-1$
+ kernelLocationText.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertFalse(tab.isValid(config));
+
+ kernelLocationText.setText(""); //$NON-NLS-1$
+ kernelLocationText.notifyListeners(SWT.Selection, null);
+ tab.performApply(config.getWorkingCopy());
+ assertTrue(tab.isValid(config));
+ }
+
+ private class OprofileTestingEventConfigTab extends OprofileEventConfigTab {
+ @Override
+ protected boolean getTimerMode() { return false; }
+ @Override
+ protected int getNumberOfCounters() { return 1; }
+ @Override
+ protected boolean checkEventSetupValidity(int counter, int number, int maskValue) { return true; }
+ public Button getDefaultCheck() { return _defaultEventCheck; }
+ }
+
+ public void testEventConfigTab() throws CoreException {
+ OprofileTestingEventConfigTab tab = new OprofileTestingEventConfigTab();
+ tab.createControl(new Shell());
+ assertNotNull(tab.getImage());
+ assertNotNull(tab.getName());
+
+ tab.setDefaults(config.getWorkingCopy());
+ tab.initializeFrom(config);
+ assertTrue(tab.isValid(config));
+
+ assertTrue(tab.getDefaultCheck().getSelection());
+ tab.getDefaultCheck().notifyListeners(SWT.Selection, null);
+ tab.getDefaultCheck().setSelection(false);
+ tab.getDefaultCheck().notifyListeners(SWT.Selection, null);
+
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false);
+ tab.performApply(wc);
+ assertFalse(tab.isValid(config));
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/test.xml b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/test.xml
new file mode 100644
index 0000000000..b51a3ac943
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch.tests/test.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+ <property name="classname" value="org.eclipse.linuxtools.oprofile.launch.tests.AllLaunchTests" />
+ <property name="plugin-name" value="org.eclipse.linuxtools.oprofile.launch.tests" />
+
+ <property name="library-file" value="${eclipse-home}/dropins/${subProjectName2}/plugins/org.eclipse.test/library.xml" />
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}/../.." />
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp />
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml" />
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="oprofile_launch_suite">
+ <property name="oprofile-launch-folder" value="${eclipse-home}/oprofile_launch_folder" />
+ <delete dir="${oprofile-launch-folder}" quiet="true" />
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${oprofile-launch-folder}" />
+ <property name="plugin-name" value="${plugin-name}" />
+ <property name="classname" value="${classname}" />
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <mkdir dir="${results}/consolelogs" />
+ <copy failonerror="false" file="${eclipse-home}/results/${classname}.txt" tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,oprofile_launch_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml" />
+ <property name="output-file" value="${plugin-name}.xml" />
+ </ant>
+ </target>
+
+ <target name="all" depends="run" description="Dummy target to run all tests">
+ </target>
+
+</project>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.launch/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/.project b/oprofile/org.eclipse.linuxtools.oprofile.launch/.project
new file mode 100644
index 0000000000..7e16bda5b6
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.launch</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.launch/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..df0870d86a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Wed Aug 06 11:12:12 EDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.launch/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.launch/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..5e2a5dc2b2
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.launch;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: %bundleProvider
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.0"
+Bundle-Activator: org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Import-Package: org.eclipse.cdt.core.model,
+ org.eclipse.cdt.debug.core,
+ org.eclipse.cdt.launch,
+ org.eclipse.cdt.utils.pty,
+ org.eclipse.cdt.utils.spawner,
+ org.eclipse.core.resources,
+ org.eclipse.debug.core,
+ org.eclipse.debug.core.model,
+ org.eclipse.debug.ui,
+ org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.daemon,
+ org.eclipse.linuxtools.oprofile.ui,
+ org.eclipse.linuxtools.oprofile.ui.view,
+ org.eclipse.linuxtools.profiling.launch,
+ org.eclipse.ui
+Export-Package: org.eclipse.linuxtools.oprofile.launch,
+ org.eclipse.linuxtools.oprofile.launch.configuration,
+ org.eclipse.linuxtools.oprofile.launch.launching
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/about.html b/oprofile/org.eclipse.linuxtools.oprofile.launch/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.launch/build.properties
new file mode 100644
index 0000000000..3268fa63fa
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/build.properties
@@ -0,0 +1,15 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ about.html
+src.includes = META-INF/,\
+ about.html,\
+ icons/,\
+ plugin.properties,\
+ plugin.xml,\
+ src/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/event_tab.gif b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/event_tab.gif
new file mode 100644
index 0000000000..c91f254ab1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/event_tab.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/global_tab.gif b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/global_tab.gif
new file mode 100644
index 0000000000..ec6cca4525
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/global_tab.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_manual_run.png b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_manual_run.png
new file mode 100644
index 0000000000..e14bdbeb41
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_manual_run.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_run.png b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_run.png
new file mode 100644
index 0000000000..4f8488f1c0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/icons/profile_run.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.properties
new file mode 100644
index 0000000000..51476d926e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.properties
@@ -0,0 +1,27 @@
+#*******************************************************************************
+# 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
+#*******************************************************************************
+bundleName=OProfile Launch Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
+
+pluginName=OProfile Launch Support
+launchconfigurationtype.label=Profile With OProfile
+launchconfigurationtype.manual.label=Profile With OProfile (Manual)
+
+launchgroup.label=OProfile
+launchgroup.titile=Select a run configuration to profile with OProfile
+
+launchmode.label=Profile
+launchmode.launchaslabel=Profile As
+
+launchshortcuts.label=Profile With OProfile
+
+manual.launchconfigurationtype.label=Profile With OProfile (Manual)
+manual.launchshortcuts.label=Profile With OProfile (Manual) \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.xml b/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.xml
new file mode 100644
index 0000000000..e5c218ae44
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/plugin.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.eclipse.linuxtools.oprofile.launch.launching.OprofileLaunchConfigurationDelegate"
+ id="org.eclipse.linuxtools.oprofile.launch.oprofile"
+ modes="profile"
+ name="%launchconfigurationtype.label"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.launch.DefaultSourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.eclipse.linuxtools.oprofile.launch.launching.OprofileManualLaunchConfigurationDelegate"
+ id="org.eclipse.linuxtools.oprofile.launch.oprofile.manual"
+ modes="profile"
+ name="%launchconfigurationtype.manual.label"
+ public="true"
+ sourceLocatorId="org.eclipse.cdt.launch.DefaultSourceLocator"
+ sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ configTypeID="org.eclipse.linuxtools.oprofile.launch.oprofile"
+ icon="icons/profile_run.png"
+ id="org.eclipse.linuxtools.oprofile.launch.oprofileImage">
+ </launchConfigurationTypeImage>
+ <launchConfigurationTypeImage
+ configTypeID="org.eclipse.linuxtools.oprofile.launch.oprofile.manual"
+ icon="icons/profile_manual_run.png"
+ id="org.eclipse.linuxtools.oprofile.launch.manual.oprofileImage">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ class="org.eclipse.linuxtools.oprofile.launch.configuration.OprofileLaunchConfigurationTabGroup"
+ id="org.eclipse.linuxtools.oprofile.launch.launchConfigurationTabGroup"
+ type="org.eclipse.linuxtools.oprofile.launch.oprofile">
+ </launchConfigurationTabGroup>
+ <launchConfigurationTabGroup
+ class="org.eclipse.linuxtools.oprofile.launch.configuration.OprofileLaunchConfigurationTabGroup"
+ id="org.eclipse.linuxtools.oprofile.launch.manualLaunchConfigurationTabGroup"
+ type="org.eclipse.linuxtools.oprofile.launch.oprofile.manual">
+ </launchConfigurationTabGroup>
+ </extension>
+ <extension
+ point="org.eclipse.debug.ui.launchShortcuts">
+ <shortcut
+ class="org.eclipse.linuxtools.oprofile.launch.launching.OprofileLaunchShortcut"
+ icon="icons/profile_run.png"
+ id="org.eclipse.linuxtools.oprofile.launch.profileshortcut"
+ label="%launchshortcuts.label"
+ modes="profile">
+ <contextualLaunch>
+ <enablement>
+<!-- FIXME: this is not a proper enablement condition -->
+ <with variable="selection">
+ <count value="1"></count>
+
+ <iterate>
+ <or>
+ <instanceof value="org.eclipse.cdt.core.model.IBinary"/>
+ <instanceof value="org.eclipse.cdt.core.model.ICProject"/>
+ <test property="org.eclipse.cdt.launch.isExecutable"/>
+ <test property="org.eclipse.cdt.launch.isCProject"/>
+ <and>
+ <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+ <adapt type="org.eclipse.core.resources.IResource">
+ <adapt type="org.eclipse.cdt.core.model.ICElement"/>
+ </adapt>
+ </and>
+ </or>
+ </iterate>
+
+ </with>
+ </enablement>
+ </contextualLaunch>
+ </shortcut>
+ <shortcut
+ class="org.eclipse.linuxtools.oprofile.launch.launching.OprofileManualLaunchShortcut"
+ icon="icons/profile_manual_run.png"
+ id="org.eclipse.linuxtools.oprofile.launch.profileshortcut.manual"
+ label="%manual.launchshortcuts.label"
+ 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
+ property="org.eclipse.cdt.launch.isExecutable">
+ </test>
+ <test
+ 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>
+</plugin>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchMessages.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchMessages.java
new file mode 100644
index 0000000000..869bd2945a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchMessages.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class OprofileLaunchMessages {
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.oprofile.launch.oprofilelaunch"; //$NON-NLS-1$
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private OprofileLaunchMessages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchPlugin.java
new file mode 100644
index 0000000000..fd7f739915
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/OprofileLaunchPlugin.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.linuxtools.oprofile.launch.configuration.EventConfigCache;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class OprofileLaunchPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static OprofileLaunchPlugin plugin;
+ //shared cache instance for configuration
+ private static EventConfigCache _eventConfigCache = null;
+
+ private static final String ID_PLUGIN = "org.eclipse.linuxtools.oprofile.launch"; //$NON-NLS-1$
+
+ // The launch type ID for profiling
+ public static final String ID_LAUNCH_PROFILE = ID_PLUGIN + ".oprofile"; //$NON-NLS-1$
+ public static final String ID_LAUNCH_PROFILE_MANUAL = ID_PLUGIN + ".oprofile.manual"; //$NON-NLS-1$
+
+
+ /* Launch Configuration attributes */
+
+ // Global options \\
+ public static final String ATTR_KERNEL_IMAGE_FILE = ID_LAUNCH_PROFILE + ".KERNEL_IMAGE"; //$NON-NLS-1$
+ public static final String ATTR_SEPARATE_SAMPLES = ID_LAUNCH_PROFILE + ".SEPARATE_SAMPLES"; //$NON-NLS-1$
+ public static final String ATTR_USE_DEFAULT_EVENT = ID_LAUNCH_PROFILE + ".USE_DEFAULT_EVENT"; //$NON-NLS-1$
+
+ // Manual Profile string \\
+ public static final String ATTR_MANUAL_PROFILE = ID_LAUNCH_PROFILE + ".MANUAL_PROFILE"; //$NON-NLS-1$
+
+ // Counter Attributes \\
+ private static final String ATTR_COUNTER(int nr) { return ID_LAUNCH_PROFILE + ".COUNTER_" + nr; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_ENABLED(int nr) { return ATTR_COUNTER(nr) + ".ENABLED"; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_EVENT(int nr) { return ATTR_COUNTER(nr) + ".EVENT"; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_PROFILE_KERNEL(int nr) { return ATTR_COUNTER(nr) + ".PROFILE_KERNEL"; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_PROFILE_USER(int nr) { return ATTR_COUNTER(nr) + ".PROFILE_USER"; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_COUNT(int nr) { return ATTR_COUNTER(nr) + ".COUNT"; } //$NON-NLS-1$
+ public static final String ATTR_COUNTER_UNIT_MASK(int nr) { return ATTR_COUNTER(nr) + ".UNIT_MASK"; } //$NON-NLS-1$
+
+
+ public static final String ICON_PATH = "icons/"; //$NON-NLS-1$
+ public static final String ICON_EVENT_TAB = ICON_PATH + "event_tab.gif"; //$NON-NLS-1$
+ public static final String ICON_GLOBAL_TAB = ICON_PATH + "global_tab.gif"; //$NON-NLS-1$
+
+
+ /**
+ * The constructor.
+ */
+ public OprofileLaunchPlugin() {
+ plugin = this;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ public static OprofileLaunchPlugin getDefault() {
+ return plugin;
+ }
+
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ public static String getUniqueIdentifier() {
+ return ID_PLUGIN;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(ID_PLUGIN, path);
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ public static EventConfigCache getCache() {
+ if (_eventConfigCache == null) {
+ _eventConfigCache = new EventConfigCache();
+ }
+
+ return _eventConfigCache;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/EventConfigCache.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/EventConfigCache.java
new file mode 100644
index 0000000000..e5d6f5c612
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/EventConfigCache.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import java.util.HashMap;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+
+/**
+ * Cache class for event configuration. Currently only used to cache the results
+ * of an `opxml check-event ..` run, since the isValid() method in the EventConfigTab
+ * needlessly spawns opxml dozens of times with the same values. Note that multiple
+ * checks of the same value will necessarily return the same result (for a given
+ * processor) so there is no worry of an invalid cache entry.
+ */
+public class EventConfigCache {
+ //a cache entry for an event check, used as the hashmap key
+ class CheckEventEntry {
+ public Integer counterNum, eventNum, maskValue;
+
+ public CheckEventEntry(int counterNum, int eventNum, int maskValue) {
+ this.counterNum = new Integer(counterNum);
+ this.eventNum = new Integer(eventNum);
+ this.maskValue = new Integer(maskValue);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof CheckEventEntry) {
+ CheckEventEntry other = (CheckEventEntry)obj;
+ return (counterNum.equals(other.counterNum) && eventNum.equals(other.eventNum) && maskValue.equals(other.maskValue));
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 11, result = 3;
+ result = prime*result + counterNum.hashCode();
+ result = prime*result + eventNum.hashCode();
+ result = prime*result + maskValue.hashCode();
+ return result;
+ }
+ }
+
+ HashMap<CheckEventEntry, Boolean> validEventCache;
+
+ /**
+ * Default constructor, creates an empty cache.
+ */
+ public EventConfigCache() {
+ validEventCache = new HashMap<CheckEventEntry, Boolean>();
+ }
+
+ /**
+ * Method to be used to check the validity of an event. Will check
+ * the cache for the result of a previous check of the same values,
+ * or otherwise will spawn opxml to check properly.
+ * @param counter counter number
+ * @param event event number
+ * @param mask unit mask value
+ * @return true or false, depending if the event config is valid
+ */
+ public boolean checkEvent(int counter, int event, int mask) {
+ CheckEventEntry e = new CheckEventEntry(counter, event, mask);
+ Boolean result = null;
+
+ result = validEventCache.get(e);
+
+ if (result == null) {
+ //not in the map, get its value and add it in
+ result = Oprofile.checkEvent(counter, event, mask);
+
+ //possible to be null if there is no opxmlProvider
+ if (result != null) {
+ validEventCache.put(e, result);
+ }
+ }
+
+ return (result == null ? false : result);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java
new file mode 100644
index 0000000000..6d4e2be8cf
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/LaunchOptions.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2004,2008,2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+
+/**
+ * This class wraps OProfile's global launch options for the
+ * Eclipse launcher facility.
+ */
+public class LaunchOptions {
+ // The launch options for the daemon
+ private OprofileDaemonOptions _options;
+
+ public LaunchOptions() {
+ _options = new OprofileDaemonOptions();
+ }
+
+ /**
+ * Determines whether the global oprofile options represented by this
+ * object are valid
+ * @return whether the options are valid
+ */
+ public boolean isValid() {
+ // The only point of contention is whether the specified vmlinux *file* exists.
+ String fn = _options.getKernelImageFile();
+ if (fn != null && fn.length() > 0) {
+ File file = new File(_options.getKernelImageFile());
+ return (file.exists() && file.isFile());
+ }
+
+ return true;
+ }
+
+ /**
+ * Saves the global options of this object into the specified launch
+ * configuration
+ * @param config the launch configuration
+ */
+ public void saveConfiguration(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(OprofileLaunchPlugin.ATTR_KERNEL_IMAGE_FILE, _options.getKernelImageFile());
+ config.setAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, _options.getSeparateProfilesMask());
+ }
+
+ /**
+ * Loads this object with the global options in the given launch
+ * configuration
+ * @param config the launch configuration
+ */
+ public void loadConfiguration(ILaunchConfiguration config) {
+ try {
+ _options.setKernelImageFile(config.getAttribute(OprofileLaunchPlugin.ATTR_KERNEL_IMAGE_FILE, "")); //$NON-NLS-1$
+ _options.setSeparateProfilesMask(config.getAttribute(OprofileLaunchPlugin.ATTR_SEPARATE_SAMPLES, OprofileDaemonOptions.SEPARATE_NONE));
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
+ * Get the daemon launch options
+ * @return the OprofileDaemonOption
+ */
+ public OprofileDaemonOptions getOprofileDaemonOptions() {
+ return _options;
+ }
+
+ /**
+ * Method getKernelImageFile.
+ * @return the kernel image file
+ */
+ public String getKernelImageFile() {
+ return _options.getKernelImageFile();
+ }
+
+ /**
+ * Sets the kernel image file
+ * @param image the kernel image file
+ */
+ public void setKernelImageFile(String image) {
+ _options.setKernelImageFile(image);
+ }
+
+ /**
+ * Method getSeparateSamples.
+ * @return whether and how to separate samples for each distinct application
+ */
+ public int getSeparateSamples() {
+ return _options.getSeparateProfilesMask();
+ }
+
+ /**
+ * Sets whether/how to collect separate samples for each distinct application
+ * @param how one of SEPARATE_{NONE, LIBRARY, KERNEL, THREAD, CPU}
+ */
+ public void setSeparateSamples(int how) {
+ _options.setSeparateProfilesMask(how);
+ }
+
+ /**
+ * Returns the path of the binary to profile.
+ * @return the full path to the binary being profile
+ */
+ public String getBinaryImage() {
+ return _options.getBinaryImage();
+ }
+
+ /**
+ * Sets the binary to profile in this launch.
+ * @param _image string of the full path to the binary
+ */
+ public void setBinaryImage(String _image) {
+ _options.setBinaryImage(_image);
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java
new file mode 100644
index 0000000000..875b2c03f7
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileCounter.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchMessages;
+
+/**
+ * This class represents an oprofile runtime configuration of a counter. It is
+ * used to construct arguments for launching op_start on the host. It
+ * simply wraps OprofileDaemonEvent.
+ */
+public class OprofileCounter {
+ private static final String COUNTER_STRING = OprofileLaunchMessages.getString("oprofileCounter.counterString"); //$NON-NLS-1$
+
+ // The counter number
+ private int _number;
+
+ // Is this counter enabled?
+ private boolean _enabled;
+
+ // The event to collect on this counter
+ private OprofileDaemonEvent _daemonEvent;
+
+ // List of valid events on this counter
+ private OpEvent[] _eventList = null;
+
+ /**
+ * Constructor for OprofileCounter.
+ * @param nr the counter number
+ */
+ public OprofileCounter(int nr) {
+ _number = nr;
+ _enabled = false;
+ _eventList = Oprofile.getEvents(_number);
+ _daemonEvent = new OprofileDaemonEvent();
+ }
+
+ /**
+ * Constructs all of the counters in the given launch configuration.
+ * @param config the launch configuration
+ * @return an array of all counters
+ */
+ public static OprofileCounter[] getCounters(ILaunchConfiguration config) {
+ OprofileCounter[] ctrs = new OprofileCounter[Oprofile.getNumberOfCounters()];
+ for (int i = 0; i < ctrs.length; i++)
+ {
+ ctrs[i] = new OprofileCounter(i);
+ if (config != null)
+ ctrs[i].loadConfiguration(config);
+ }
+
+ return ctrs;
+ }
+
+ /**
+ * Method setEnabled.
+ * @param enabled whether to set this counter as enabled
+ */
+ public void setEnabled(boolean enabled) {
+ _enabled = enabled;
+ }
+
+ /**
+ * Method setEvent.
+ * @param event the event for this counter
+ */
+ public void setEvent(OpEvent event) {
+ _daemonEvent.setEvent(event);
+ }
+
+ /**
+ * Method setProfileKernel.
+ * @param profileKernel whether this counter should count kernel events
+ */
+ public void setProfileKernel(boolean profileKernel) {
+ _daemonEvent.setProfileKernel(profileKernel);
+ }
+
+ /**
+ * Method setProfileUser.
+ * @param profileUser whether this counter should count user events
+ */
+ public void setProfileUser(boolean profileUser) {
+ _daemonEvent.setProfileUser(profileUser);
+ }
+
+ /**
+ * Method setCount.
+ * @param count the number of events between samples for this counter
+ */
+ public void setCount(int count) {
+ _daemonEvent.setResetCount(count);
+ }
+
+ /**
+ * Saves this counter's configuration into the specified launch
+ * configuration.
+ * @param config the launch configuration
+ */
+ public void saveConfiguration(ILaunchConfigurationWorkingCopy config) {
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(_number), _enabled);
+ if (_daemonEvent.getEvent() != null) {
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_EVENT(_number), _daemonEvent.getEvent().getText());
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(_number), _daemonEvent.getEvent().getUnitMask().getMaskValue());
+ }
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(_number), _daemonEvent.getProfileKernel());
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(_number), _daemonEvent.getProfileUser());
+ config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_COUNT(_number), _daemonEvent.getResetCount());
+ }
+
+ /**
+ * Loads a counter configuration from the specified launch configuration.
+ * @param config the launch configuration
+ */
+ public void loadConfiguration(ILaunchConfiguration config) {
+ try {
+ _enabled = config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(_number), false);
+
+ String str = config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_EVENT(_number), ""); //$NON-NLS-1$
+ _daemonEvent.setEvent(_eventFromString(str));
+
+ if (_daemonEvent.getEvent() == null) {
+ return;
+ }
+
+
+ int maskValue = config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(_number), OpUnitMask.SET_DEFAULT_MASK);
+ _daemonEvent.getEvent().getUnitMask().setMaskValue(maskValue);
+
+ _daemonEvent.setProfileKernel(config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(_number), false));
+ _daemonEvent.setProfileUser(config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(_number), false));
+
+ _daemonEvent.setResetCount(config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_COUNT(_number), OprofileDaemonEvent.COUNT_UNINITIALIZED));
+ } catch (CoreException ce) {
+
+ }
+ }
+
+ public OpUnitMask getUnitMask() {
+ OpEvent event = _daemonEvent.getEvent();
+
+ if (event != null) {
+ return event.getUnitMask();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns a textual label for this counter (used by UI)
+ * @return the label to use in widgets referring to this counter
+ */
+ public String getText() {
+ Object[] args = new Object[] {new Integer(_number)};
+ return MessageFormat.format(COUNTER_STRING, args);
+ }
+
+ /**
+ * Method getNumber.
+ * @return the counter's number
+ */
+ public int getNumber() {
+ return _number;
+ }
+
+ /**
+ * Method getEnabled.
+ * @return whether this counter is enabled
+ */
+ public boolean getEnabled() {
+ return _enabled;
+ }
+
+ /**
+ * Method getEvent.
+ * @return the event for this counter
+ */
+ public OpEvent getEvent() {
+ return _daemonEvent.getEvent();
+ }
+
+ /**
+ * Method getProfileKernel.
+ * @return whether this counter is counting kernel events
+ */
+ public boolean getProfileKernel() {
+ return _daemonEvent.getProfileKernel();
+ }
+
+ /**
+ * Method getProfileUser.
+ * @return whether this counter is counting user events
+ */
+ public boolean getProfileUser() {
+ return _daemonEvent.getProfileUser();
+ }
+
+ /**
+ * Method getCount.
+ * @return the number of events between samples for this counter
+ */
+ public int getCount() {
+ return _daemonEvent.getResetCount();
+ }
+
+ /**
+ * Method getValidEvents.
+ * @return an array of all events that this counter can monitor
+ */
+ public OpEvent[] getValidEvents() {
+ return _eventList;
+ }
+
+ /**
+ * Gets the daemon event configuration for this counter.
+ * <B>Not</B> valid if this counter is not enabled!
+ * @return the OprofileDaemonEvent
+ */
+ public OprofileDaemonEvent getDaemonEvent() {
+ return _daemonEvent;
+ }
+
+ // Returns the event with the same label as the parameter STR
+ private OpEvent _eventFromString(String str) {
+ for (int i = 0; i < _eventList.length; i++) {
+ if (_eventList[i].getText().equals(str))
+ return _eventList[i];
+ }
+
+ return null;
+ }
+}
+
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileEventConfigTab.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileEventConfigTab.java
new file mode 100644
index 0000000000..0ceab909fb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileEventConfigTab.java
@@ -0,0 +1,800 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *
+ * CounterSubTab Contributors:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation (before subclassing)
+ * Kent Sebastian <ksebasti@redhat.com> - turned into a sub class,
+ * changed layouts, fixed up some interactivity issues, ..
+ *
+ * UnitMaskViewer Contributors:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com>
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchMessages;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Thic class represents the event configuration tab of the launcher dialog.
+ */
+public class OprofileEventConfigTab extends AbstractLaunchConfigurationTab {
+ protected Button _defaultEventCheck;
+ protected OprofileCounter[] _counters = OprofileCounter.getCounters(null);
+ protected CounterSubTab[] _counterSubTabs;
+
+ /**
+ * Essentially the constructor for this tab; creates the 'default event'
+ * checkbox and an appropriate number of counter tabs.
+ * @param parent the parent composite
+ */
+ public void createControl(Composite parent) {
+ Composite top = new Composite(parent, SWT.NONE);
+ setControl(top);
+ top.setLayout(new GridLayout());
+
+ if (getTimerMode()) {
+ Label timerModeLabel = new Label(top, SWT.LEFT);
+ timerModeLabel.setText(OprofileLaunchMessages.getString("tab.event.timermode.no.options")); //$NON-NLS-1$
+ } else {
+ createVerticalSpacer(top, 1);
+
+ //default event checkbox
+ _defaultEventCheck = new Button(top, SWT.CHECK);
+ _defaultEventCheck.setText(OprofileLaunchMessages.getString("tab.event.defaultevent.button.text")); //$NON-NLS-1$
+ _defaultEventCheck.setLayoutData(new GridData());
+ _defaultEventCheck.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _handleEnabledToggle();
+ }
+ });
+
+ createVerticalSpacer(top, 1);
+
+ //tabs for each of the counters
+ OprofileCounter[] counters = OprofileCounter.getCounters(null);
+ TabItem[] counterTabs = new TabItem[counters.length];
+ _counterSubTabs = new CounterSubTab[counters.length];
+
+ TabFolder tabFolder = new TabFolder(top, SWT.NONE);
+ tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+
+ for (int i = 0; i < counters.length; i++) {
+ Composite c = new Composite(tabFolder, SWT.NONE);
+ CounterSubTab currentTab = new CounterSubTab(c, counters[i]);
+ _counterSubTabs[i] = currentTab;
+
+ counterTabs[i] = new TabItem(tabFolder, SWT.NONE);
+ counterTabs[i].setControl(c);
+ counterTabs[i].setText(OprofileLaunchMessages.getString("tab.event.counterTab.counterText") + String.valueOf(i)); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration config) {
+ if (!getTimerMode()) {
+ try {
+ for (int i = 0; i < _counters.length; i++) {
+ _counters[i].loadConfiguration(config);
+ }
+
+ for (CounterSubTab tab : _counterSubTabs) {
+ tab.initializeTab(config);
+ }
+
+ boolean enabledState = config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, true);
+ _defaultEventCheck.setSelection(enabledState);
+ setEnabledState(!enabledState);
+
+ updateLaunchConfigurationDialog();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#isValid(ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+ if (getTimerMode()) {
+ return true; //no options to check for validity
+ } else {
+ int numEnabledEvents = 0;
+ boolean valid = true;
+
+ try {
+ if (config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) {
+ numEnabledEvents = 1;
+ } else {
+ //This seems like an odd way to validate, but since most of the validation
+ // is done with the OprofileDaemonEvent that the counter wraps, this
+ // is the easiest way.
+ OprofileCounter[] counters = new OprofileCounter[getNumberOfCounters()];
+ for (int i = 0; i < counters.length; i++) {
+ counters[i] = new OprofileCounter(i);
+ counters[i].loadConfiguration(config);
+ if (counters[i].getEnabled()) {
+ ++numEnabledEvents;
+
+ if (counters[i].getEvent() == null) {
+ valid = false;
+ break;
+ }
+
+ // First check min count
+ int min = counters[i].getEvent().getMinCount();
+ if (counters[i].getCount() < min) {
+ valid = false;
+ break;
+ }
+
+ // Next ask oprofile if it is valid
+ if (!checkEventSetupValidity(counters[i].getNumber(), counters[i].getEvent().getNumber(), counters[i].getEvent().getUnitMask().getMaskValue())) {
+ valid = false;
+ break;
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return (numEnabledEvents > 0 && valid);
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ if (getTimerMode()) {
+ config.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, true);
+ } else {
+ config.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, _defaultEventCheck.getSelection());
+
+ for (CounterSubTab cst : _counterSubTabs) {
+ cst.performApply(config);
+ }
+ }
+ try {
+ config.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ boolean useDefault = true;
+
+ // When instantiated, the OprofileCounter will set defaults.
+ for (int i = 0; i < _counters.length; i++) {
+ _counters[i].saveConfiguration(config);
+ if (_counters[i].getEnabled()) {
+ useDefault = false;
+ }
+ }
+
+ config.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, useDefault);
+ try {
+ config.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return OprofileLaunchMessages.getString("tab.event.name"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see ILaunchConfigurationTab#getImage()
+ */
+ @Override
+ public Image getImage() {
+ return OprofileLaunchPlugin.getImageDescriptor(OprofileLaunchPlugin.ICON_EVENT_TAB).createImage();
+ }
+
+ /**
+ * Handles the toggling of the default event check box. Not meant to be called
+ * directly.
+ */
+ private void _handleEnabledToggle() {
+ setEnabledState(!_defaultEventCheck.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Sets the state of the child counter tabs' widgets.
+ * @param state true for enabled, false for disabled
+ */
+ private void setEnabledState(boolean state) {
+ for (CounterSubTab cst : _counterSubTabs) {
+ cst.setEnabledState(state);
+ }
+ }
+
+ /*
+ * Extracted methods to be overridden by the test suite.
+ */
+
+ /**
+ * Returns whether the event's unit mask is valid
+ * @param counter counter number
+ * @param number event number (oprofile internal number)
+ * @param maskValue unit mask value
+ * @return true if valid config, false otherwise
+ */
+ protected boolean checkEventSetupValidity(int counter, int number, int maskValue) {
+ return OprofileLaunchPlugin.getCache().checkEvent(counter, number, maskValue);
+ }
+
+ /**
+ * Returns whether or not oprofile is operating in timer mode.
+ * @return true if oprofile is in timer mode, false otherwise
+ */
+ protected boolean getTimerMode() {
+ return Oprofile.getTimerMode();
+ }
+
+ /**
+ * Returns the number of hardware counters the cpu has
+ * @return int number of counters
+ */
+ protected int getNumberOfCounters() {
+ return Oprofile.getNumberOfCounters();
+ }
+
+ /**
+ * A sub-tab of the OprofileEventConfigTab launch configuration tab.
+ * Essentially, it is a frontend to an OprofileCounter. This is an
+ * inner class because it requires methods from the parent tab (such as
+ * updateLaunchConfigurationDialog() when a widget changes state).
+ */
+ protected class CounterSubTab {
+ private Button _enabledCheck;
+ private Button _profileKernelCheck;
+ private Button _profileUserCheck;
+ private Label _countTextLabel;
+ private Text _countText;
+ private Label _eventDescLabel;
+ private Text _eventDescText;
+ private UnitMaskViewer _unitMaskViewer;
+ private ListViewer _eventList;
+ private OprofileCounter _counter;
+
+ private ScrolledComposite _scrolledTop;
+ private Composite _tabTopContainer;
+
+ /**
+ * Constructor for a subtab. Creates the layout and widgets for its content.
+ * @param parent composite the widgets will be created in
+ * @param counter the associated OprofileCounter object
+ */
+ public CounterSubTab(Composite parent, OprofileCounter counter) {
+ _counter = counter;
+
+ parent.setLayout(new GridLayout());
+
+ //scrollable composite on top
+ ScrolledComposite scrolledContainer = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ scrolledContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ scrolledContainer.setLayout(layout);
+ scrolledContainer.setExpandHorizontal(true);
+ scrolledContainer.setExpandVertical(true);
+
+ //composite to contain the rest of the tab
+ Composite tabTopContainer = new Composite(scrolledContainer, SWT.NONE);
+ scrolledContainer.setContent(tabTopContainer);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ tabTopContainer.setLayout(layout);
+ tabTopContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ //top cell
+ Composite topCellComp = new Composite(tabTopContainer, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ topCellComp.setLayout(layout);
+ topCellComp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
+
+ createTopCell(topCellComp);
+
+ createVerticalSpacer(tabTopContainer, 2);
+
+ //left side composite group for eventList
+ Composite eventListComp = new Composite(tabTopContainer, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ eventListComp.setLayout(layout);
+ //layoutdata is set later
+
+ createLeftCell(eventListComp);
+
+
+ //right side composite group for other event config and unit mask
+ Composite eventConfigComp = new Composite(tabTopContainer, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ eventConfigComp.setLayout(layout);
+ eventConfigComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ createRightCell(eventConfigComp);
+
+
+ //set the list's composite layout based on the right cell's size
+ GridData data = new GridData(SWT.FILL, SWT.FILL, false, true);
+ data.heightHint = eventConfigComp.getSize().x;
+ eventListComp.setLayoutData(data);
+
+ _scrolledTop = scrolledContainer;
+ _tabTopContainer = tabTopContainer;
+ }
+
+ /**
+ * Creates the "Enabled" checkbox, and the event description text.
+ * @param parent composite these widgets will be created in
+ */
+ private void createTopCell(Composite parent) {
+ //checkbox
+ _enabledCheck = new Button(parent, SWT.CHECK);
+ _enabledCheck.setText(OprofileLaunchMessages.getString("tab.event.counterSettings.enabled.button.text")); //$NON-NLS-1$
+ _enabledCheck.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+ _enabledCheck.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _counter.setEnabled(_enabledCheck.getSelection());
+ _setEnabledState(_counter.getEnabled());
+ updateLaunchConfigurationDialog();
+ }
+ });
+ _enabledCheck.setEnabled(false);
+
+ //label for textbox
+ _eventDescLabel = new Label(parent, SWT.NONE);
+ _eventDescLabel.setText(OprofileLaunchMessages.getString("tab.event.eventDescription.label.text")); //$NON-NLS-1$
+ _eventDescLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+ //textbox
+ _eventDescText = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
+ _eventDescText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ /**
+ * Creates the event list widget.
+ * @param parent composite these widgets will be created in
+ */
+ private void createLeftCell(Composite parent) {
+ _eventList = new ListViewer(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ _eventList.getList().setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
+
+ _eventList.setLabelProvider(new ILabelProvider(){
+ public String getText(Object element) {
+ OpEvent e = (OpEvent) element;
+ return e.getText();
+ }
+ public Image getImage(Object element) { return null; }
+ public void addListener(ILabelProviderListener listener) { }
+ public void dispose() { }
+ public boolean isLabelProperty(Object element, String property) { return false; }
+ public void removeListener(ILabelProviderListener listener) { }
+ });
+
+ _eventList.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ OprofileCounter ctr = (OprofileCounter) inputElement;
+ return (OpEvent[]) ctr.getValidEvents();
+ }
+ public void dispose() { }
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) { }
+ });
+
+ //adds the events to the list from the counter
+ _eventList.setInput(_counter);
+
+ _eventList.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent sce) {
+ _handleEventListSelectionChange();
+ }
+ });
+ }
+
+ /**
+ * Creates the 2 profile space checkboxes, event count and unit mask widget.
+ * @param parent composite these widgets will be created in
+ */
+ private void createRightCell(Composite parent) {
+ //profile kernel checkbox
+ _profileKernelCheck = new Button(parent, SWT.CHECK);
+ _profileKernelCheck.setText(OprofileLaunchMessages.getString("tab.event.counterSettings.profileKernel.check.text")); //$NON-NLS-1$
+ _profileKernelCheck.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _handleProfileKernelToggle();
+ }
+ });
+
+ //profile user checkbox -- should this ever be disabled?
+ _profileUserCheck = new Button(parent, SWT.CHECK);
+ _profileUserCheck.setText(OprofileLaunchMessages.getString("tab.event.counterSettings.profileUser.check.text")); //$NON-NLS-1$
+ _profileUserCheck.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _handleProfileUserToggle();
+ }
+ });
+
+ //event count label/text
+ _countTextLabel = new Label(parent, SWT.NONE);
+ _countTextLabel.setText(OprofileLaunchMessages.getString("tab.event.counterSettings.count.label.text")); //$NON-NLS-1$
+ _countText = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ _countText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ _countText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent me) {
+ _handleCountTextModify();
+ }
+ });
+
+ //unit mask widget
+ Composite unitMaskComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ unitMaskComp.setLayout(layout);
+ unitMaskComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ _unitMaskViewer = new UnitMaskViewer(unitMaskComp);
+ }
+
+ /**
+ * Initializes the tab on first creation.
+ * @param config default configuration for the counter and the associated widgets
+ */
+ public void initializeTab(ILaunchConfiguration config) {
+ //make all controls inactive, since the 'default event' checkbox
+ // is checked by default
+ setEnabledState(false);
+
+ if (config != null) {
+ _counter.loadConfiguration(config);
+ }
+
+ boolean enabled = _counter.getEnabled();
+ _enabledCheck.setSelection(enabled);
+
+ if (_counter.getEvent() == null) {
+ // Default to first in list
+ _counter.setEvent(_counter.getValidEvents()[0]);
+ }
+
+ //load default states
+ _profileKernelCheck.setSelection(_counter.getProfileKernel());
+ _profileUserCheck.setSelection(_counter.getProfileUser());
+ _countText.setText(Integer.toString(_counter.getCount()));
+ _eventDescText.setText(_counter.getEvent().getTextDescription());
+ _unitMaskViewer.displayEvent(_counter.getEvent());
+ _eventList.setSelection(new StructuredSelection(_counter.getEvent()));
+ }
+
+ /**
+ * Applies the tab's current state to the launch configuration.
+ * @param config launch config to apply to
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ _counter.saveConfiguration(config);
+ try {
+ config.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Enables/disables the widgets in this tab.
+ * @param state true to enable to the counter's state, false to disable all
+ */
+ public void setEnabledState(boolean state) {
+ _enabledCheck.setEnabled(state);
+
+ if (state) {
+ _setEnabledState(_counter.getEnabled());
+ } else {
+ _setEnabledState(false);
+ }
+ }
+
+ /**
+ * Method split from setEnabledState to avoid code duplication.
+ * Not meant to be called directly.
+ * @param state true to enable all widgets, false to disable all widgets
+ */
+ private void _setEnabledState(boolean state) {
+ _profileKernelCheck.setEnabled(state);
+ _profileUserCheck.setEnabled(state);
+ _countText.setEnabled(state);
+ _eventDescText.setEnabled(state);
+ _unitMaskViewer.setEnabled(state);
+ _eventList.getList().setEnabled(state);
+ }
+
+ /**
+ * Handling method for the event list. Gets the selection from the listviewer
+ * and updates the UnitMask and event description text box.
+ */
+ private void _handleEventListSelectionChange() {
+ int index = _eventList.getList().getSelectionIndex();
+ OpEvent event = (OpEvent) _eventList.getElementAt(index);
+ _counter.setEvent(event);
+ _eventDescText.setText(event.getTextDescription());
+ _unitMaskViewer.displayEvent(event);
+
+ // Check the min count to update the error message (events can have
+ // different minimum reset counts)
+ int min = _counter.getEvent().getMinCount();
+ if (_counter.getCount() < min) {
+ setErrorMessage(getMinCountErrorMessage(min));
+ }
+
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Handles the toggling of the "profile user" button.
+ */
+ private void _handleProfileUserToggle() {
+ _counter.setProfileUser(_profileUserCheck.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Handles the toggling of the "profile kernel" button.
+ */
+ private void _handleProfileKernelToggle() {
+ _counter.setProfileKernel(_profileKernelCheck.getSelection());
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Handles text modify events in the count text widget.
+ */
+ private void _handleCountTextModify() {
+ String errorMessage = null;
+ try {
+
+ // This seems counter-intuitive, but we must save the count
+ // so that isValid knows this launch config is invalid
+ int count = Integer.parseInt(_countText.getText());
+ _counter.setCount(count);
+
+ // Check minimum count
+ int min = _counter.getEvent().getMinCount();
+ if (count < min) {
+ errorMessage = getMinCountErrorMessage(min);
+ }
+ } catch (NumberFormatException e) {
+ errorMessage = OprofileLaunchMessages.getString("tab.event.counterSettings.count.invalid"); //$NON-NLS-1$
+ _counter.setCount(OprofileDaemonEvent.COUNT_INVALID);
+ } finally {
+ setErrorMessage(errorMessage);
+ updateLaunchConfigurationDialog();
+ }
+ }
+
+ /**
+ * Returns a string with the minimum allowed count, suitable foruse with setErrorMessage().
+ * @param min minimum count
+ * @return a String containing the error message
+ */
+ private String getMinCountErrorMessage(int min) {
+ String msg = OprofileLaunchMessages.getString("tab.event.counterSettings.count.too-small"); //$NON-NLS-1$
+ Object[] args = new Object[] { new Integer(min) };
+ return MessageFormat.format(msg, args);
+ }
+
+ /**
+ * Changes parameters for the top scrolled composite which makes the scroll bars
+ * appear when content overflows the visible area. Called by the UnitMaskViewer
+ * whenever a new set of unit mask buttons are created, since the number of them is
+ * variable and there is no guarantee as to the default size of the launch configuration
+ * dialog in general.
+ */
+ private void resizeScrollContainer() {
+ _scrolledTop.setMinSize(_tabTopContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ }
+
+
+ /**
+ * This class displays event unit masks via check boxes and appropriate labels.
+ */
+ protected class UnitMaskViewer {
+ private Label _unitMaskLabel;
+ private Composite _top;
+ private Composite _maskListComp;
+ private Button[] _unitMaskButtons;
+
+ /**
+ * Constructor, creates the widget.
+ * @param parent composite the widget will be created in
+ */
+ public UnitMaskViewer(Composite parent) {
+ //"Unit Mask:" label
+ _unitMaskLabel = new Label(parent, SWT.NONE);
+ _unitMaskLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+ _unitMaskLabel.setText(OprofileLaunchMessages.getString("unitmaskViewer.label.text")); //$NON-NLS-1$
+ _unitMaskLabel.setVisible(true);
+
+ //composite to contain the button widgets
+ Composite top = new Composite(parent, SWT.NONE);
+ top.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ top.setLayout(layout);
+ _top = top;
+
+ _maskListComp = null;
+ _unitMaskButtons = null;
+ }
+
+ /**
+ * Handles button toggles; updates the counter's unit mask to the appropriate value.
+ * @param maskButton the button object
+ * @param index the button's mask index (used in OpUnitMask for a proper mask value)
+ */
+ private void _handleToggle(Button maskButton, int index) {
+ OpUnitMask mask = _counter.getUnitMask();
+ if (mask != null) {
+ if (maskButton.getSelection()) {
+ mask.setMaskFromIndex(index);
+ } else {
+ mask.unSetMaskFromIndex(index);
+ }
+ }
+
+ //update the parent tab
+ updateLaunchConfigurationDialog();
+ }
+
+ /**
+ * Disposes of the old unit mask check list and creates a new one with
+ * the appropriate default value.
+ * @param oe the event
+ */
+ public void displayEvent(OpEvent oe) {
+ OpUnitMask mask = oe.getUnitMask();
+ int totalMasks = mask.getNumMasks();
+
+ if (_maskListComp != null) {
+ _maskListComp.dispose();
+ }
+
+ Composite newMaskComp = new Composite(_top, SWT.NONE);
+ newMaskComp.setLayout(new GridLayout());
+ newMaskComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
+ _maskListComp = newMaskComp;
+
+ //creates these buttons with the default masks
+ mask.setDefaultMaskValue();
+
+ ArrayList<Button> maskButtons = new ArrayList<Button>();
+
+ for (int i = 0; i < totalMasks; i++) {
+ Button maskButton;
+
+ if (mask.getType() == OpUnitMask.INVALID) {
+ //big problem, most likely parsing went awry or opxml output mangled
+ OprofileCorePlugin.showErrorDialog("opxmlParse", null); //$NON-NLS-1$
+ return;
+ } else if (mask.getType() == OpUnitMask.MANDATORY) {
+ maskButton = new Button(newMaskComp, SWT.RADIO);
+ maskButton.setEnabled(false);
+ maskButton.setText(mask.getText(i));
+ maskButton.setSelection(true);
+ } else {
+ int buttonType;
+ final int maskButtonIndex = i;
+ boolean selected = mask.isMaskSetFromIndex(maskButtonIndex);
+
+ if (mask.getType() == OpUnitMask.EXCLUSIVE) {
+ buttonType = SWT.RADIO;
+ } else { //mask type is OpUnitMask.BITMASK
+ buttonType = SWT.CHECK;
+ }
+
+ maskButton = new Button(newMaskComp, buttonType);
+ maskButton.setEnabled(true);
+ maskButton.setText(mask.getText(i));
+ maskButton.setSelection(selected);
+ maskButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _handleToggle((Button)se.getSource(), maskButtonIndex);
+ }
+ });
+
+ maskButtons.add(maskButton);
+ }
+ }
+
+ _unitMaskButtons = new Button[maskButtons.size()];
+ maskButtons.toArray(_unitMaskButtons);
+
+ resizeScrollContainer();
+ }
+
+ /**
+ * Enables and disables the viewer for UI input
+ * @param enabled whether this viewer should be enabled
+ */
+ public void setEnabled(boolean enabled) {
+ if (_unitMaskButtons != null) {
+ for (Button b : _unitMaskButtons) {
+ b.setEnabled(enabled);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileLaunchConfigurationTabGroup.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileLaunchConfigurationTabGroup.java
new file mode 100644
index 0000000000..047cfcf869
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileLaunchConfigurationTabGroup.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
+
+public class OprofileLaunchConfigurationTabGroup extends ProfileLaunchConfigurationTabGroup {
+ @Override
+ public AbstractLaunchConfigurationTab[] getProfileTabs() {
+ return new AbstractLaunchConfigurationTab[] { new OprofileSetupTab(), new OprofileEventConfigTab() };
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileSetupTab.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileSetupTab.java
new file mode 100644
index 0000000000..d523ea63c9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/configuration/OprofileSetupTab.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.configuration;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchMessages;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This tab is used by the launcher to configure global oprofile run options.
+ */
+public class OprofileSetupTab extends AbstractLaunchConfigurationTab {
+ protected Text _kernelImageFileText;
+
+ protected Button _checkSeparateLibrary;
+ protected Button _checkSeparateKernel;
+ //maybe these later
+// protected Button _checkSeparateThread;
+// protected Button _checkSeparateCpu;
+
+ protected static LaunchOptions _options = null;
+
+ public String getName() {
+ return OprofileLaunchMessages.getString("tab.global.name"); //$NON-NLS-1$
+ }
+
+ public boolean isValid(ILaunchConfiguration config) {
+ boolean b = _options.isValid();
+ // System.out.println("SetupTab isValid = " + b);
+ return b;
+ }
+
+ public void performApply(ILaunchConfigurationWorkingCopy config) {
+ _options.saveConfiguration(config);
+ try {
+ config.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void initializeFrom(ILaunchConfiguration config) {
+ _options.loadConfiguration(config);
+
+ _kernelImageFileText.setText(_options.getKernelImageFile());
+
+ int separate = _options.getSeparateSamples();
+
+ if (separate == OprofileDaemonOptions.SEPARATE_NONE) {
+ _checkSeparateLibrary.setSelection(false);
+ _checkSeparateKernel.setSelection(false);
+ } else {
+ //note that opcontrol will nicely ignore the trailing comma
+ if ((separate & OprofileDaemonOptions.SEPARATE_LIBRARY) != 0)
+ _checkSeparateLibrary.setSelection(true);
+ if ((separate & OprofileDaemonOptions.SEPARATE_KERNEL) != 0)
+ _checkSeparateKernel.setSelection(true);
+// if ((separate & OprofileDaemonOptions.SEPARATE_THREAD) != 0)
+// _checkSeparateThread.setSelection(true);
+// if ((separate & OprofileDaemonOptions.SEPARATE_CPU) != 0)
+// _checkSeparateCpu.setSelection(true);
+ }
+ }
+
+ public void setDefaults(ILaunchConfigurationWorkingCopy config) {
+ _options = new LaunchOptions();
+ _options.saveConfiguration(config);
+ try {
+ config.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public Image getImage() {
+ return OprofileLaunchPlugin.getImageDescriptor(OprofileLaunchPlugin.ICON_GLOBAL_TAB).createImage();
+ }
+
+ public void createControl(Composite parent) {
+ _options = new LaunchOptions();
+
+ Composite top = new Composite(parent, SWT.NONE);
+ setControl(top);
+ top.setLayout(new GridLayout());
+
+ GridData data;
+ GridLayout layout;
+ createVerticalSpacer(top, 1);
+
+ // Create container for kernel image file selection
+ Composite p = new Composite(top, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ p.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ p.setLayoutData(data);
+
+ Label l = new Label(p, SWT.NONE);
+ l.setText(OprofileLaunchMessages.getString("tab.global.kernelImage.label.text")); //$NON-NLS-1$
+ data = new GridData();
+ data.horizontalSpan = 2;
+ l.setLayoutData(data);
+
+ _kernelImageFileText = new Text(p, SWT.SINGLE | SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ _kernelImageFileText.setLayoutData(data);
+ _kernelImageFileText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent mev) {
+ _handleKernelImageFileTextModify(_kernelImageFileText);
+ };
+ });
+
+ Button button = createPushButton(p, OprofileLaunchMessages.getString("tab.global.kernelImage.browse.button.text"), null); //$NON-NLS-1$
+ final Shell shell = top.getShell();
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent sev) {
+ _showFileDialog(shell);
+ }
+ });
+
+ createVerticalSpacer(top, 1);
+
+ // Create checkbox options container
+ p = new Composite(top, SWT.NONE);
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ p.setLayout(layout);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ p.setLayoutData(data);
+
+ _checkSeparateLibrary = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateLibrary.text")); //$NON-NLS-1$
+ _checkSeparateKernel = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateKernel.text")); //$NON-NLS-1$
+// _checkSeparateThread = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateThread.text")); //$NON-NLS-1$
+// _checkSeparateCpu = _createCheckButton(p, OprofileLaunchMessages.getString("tab.global.check.separateCpu.text")); //$NON-NLS-1$
+ }
+
+ // convenience method to create radio buttons with the given label
+ private Button _createCheckButton(Composite parent, String label) {
+ final Button b = new Button(parent, SWT.CHECK);
+ b.setText(label);
+ b.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent se) {
+ _handleCheckSelected(b);
+ }
+ });
+
+ return b;
+ }
+
+ //sets the proper separation mask for sample separation
+ private void _handleCheckSelected(Button button) {
+ int oldSeparate = _options.getSeparateSamples();
+ int newSeparate = oldSeparate; //initalize
+
+ if (button == _checkSeparateLibrary) {
+ if (button.getSelection()) {
+ newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_LIBRARY;
+ } else {
+ newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_LIBRARY;
+ }
+ } else if (button == _checkSeparateKernel) {
+ if (button.getSelection()) {
+ newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_KERNEL;
+ } else {
+ newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_KERNEL;
+ }
+// } else if (button == _checkSeparateThread) {
+// if (button.getSelection()) {
+// newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_THREAD;
+// } else {
+// newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_THREAD;
+// }
+// } else if (button == _checkSeparateCpu) {
+// if (button.getSelection()) {
+// newSeparate = oldSeparate | OprofileDaemonOptions.SEPARATE_CPU;
+// } else {
+// newSeparate = oldSeparate & ~OprofileDaemonOptions.SEPARATE_CPU;
+// }
+ }
+
+ _options.setSeparateSamples(newSeparate);
+
+ updateLaunchConfigurationDialog();
+ }
+
+ // handles text modification events for all text boxes in this tab
+ private void _handleKernelImageFileTextModify(Text text) {
+ String errorMessage = null;
+ String filename = text.getText();
+
+ if (filename.length() > 0) {
+ File file = new File(filename);
+ if (!file.exists() || !file.isFile()) {
+ String msg = OprofileLaunchMessages.getString("tab.global.kernelImage.kernel.nonexistent"); //$NON-NLS-1$
+ Object[] args = new Object[] { filename };
+ errorMessage = MessageFormat.format(msg, args);
+ }
+
+ //seems odd, but must set it even if it is invalid so that performApply
+ // and isValid work properly
+ _options.setKernelImageFile(filename);
+ } else {
+ // no kernel image file
+ _options.setKernelImageFile(new String());
+ }
+
+ // Update dialog and error message
+ setErrorMessage(errorMessage);
+ updateLaunchConfigurationDialog();
+ }
+
+ // Displays a file dialog to allow the user to select the kernel image file
+ private void _showFileDialog(Shell shell) {
+ FileDialog d = new FileDialog(shell, SWT.OPEN);
+ File kernel = new File(_options.getKernelImageFile());
+ if (!kernel.exists()) {
+ kernel = new File("/boot"); //$NON-NLS-1$
+ if (!kernel.exists())
+ kernel = new File("/"); //$NON-NLS-1$
+ }
+ d.setFileName(kernel.toString());
+ d.setText(OprofileLaunchMessages.getString("tab.global.selectKernelDialog.text")); //$NON-NLS-1$
+ String newKernel = d.open();
+ if (newKernel != null) {
+ kernel = new File(newKernel);
+ if (!kernel.exists()) {
+ MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.RETRY | SWT.CANCEL);
+ mb.setMessage(OprofileLaunchMessages.getString("tab.global.selectKernelDialog.error.kernelDoesNotExist.text")); //$NON-NLS-1$
+ switch (mb.open()) {
+ case SWT.RETRY:
+ // Ok, it's recursive, but it shouldn't matter
+ _showFileDialog(shell);
+ break;
+ default:
+ case SWT.CANCEL:
+ break;
+ }
+ } else {
+ _kernelImageFileText.setText(newKernel);
+ }
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
new file mode 100644
index 0000000000..319551a75a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/AbstractOprofileLaunchConfigurationDelegate.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 Red Hat, Inc. and others
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ * Keith Seitz <keiths@redhat.com> - setup code in launch the method, initially
+ * written in the now-defunct OprofileSession class
+ * QNX Software Systems and others - the section of code marked in the launch
+ * method, and the exec method
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.launching;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.AbstractCLaunchDelegate;
+import org.eclipse.cdt.utils.pty.PTY;
+import org.eclipse.cdt.utils.spawner.ProcessFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileCounter;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.linuxtools.oprofile.ui.view.OprofileView;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class AbstractOprofileLaunchConfigurationDelegate extends AbstractCLaunchDelegate {
+ public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ LaunchOptions options = new LaunchOptions(); //default options created in the constructor
+ options.loadConfiguration(config);
+ IPath exePath = verifyProgramPath( config );
+ options.setBinaryImage(exePath.toOSString());
+
+ //if daemonEvents null or zero size, the default event will be used
+ OprofileDaemonEvent[] daemonEvents = null;
+ if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) {
+ //get the events to profile from the counters
+ OprofileCounter[] counters = OprofileCounter.getCounters(config);
+ ArrayList<OprofileDaemonEvent> events = new ArrayList<OprofileDaemonEvent>();
+
+ for (int i = 0; i < counters.length; ++i) {
+ if (counters[i].getEnabled())
+ events.add(counters[i].getDaemonEvent());
+ }
+
+ daemonEvents = new OprofileDaemonEvent[events.size()];
+ events.toArray(daemonEvents);
+ }
+
+ if (!preExec(options, daemonEvents)) return;
+
+ /*
+ * this code written by QNX Software Systems and others and was
+ * originally in the CDT under LocalCDILaunchDelegate::RunLocalApplication
+ */
+ //set up and launch the local c/c++ program
+ try {
+ File wd = getWorkingDirectory( config );
+ if ( wd == null ) {
+ wd = new File( System.getProperty( "user.home", "." ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ String arguments[] = getProgramArgumentsArray( config );
+ ArrayList<String> command = new ArrayList<String>( 1 + arguments.length );
+ command.add( exePath.toOSString() );
+ command.addAll( Arrays.asList( arguments ) );
+ String[] commandArray = (String[])command.toArray( new String[command.size()] );
+ boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT);
+ Process process;
+ process = exec( commandArray, getEnvironment( config ), wd, usePty );
+ DebugPlugin.newProcess( launch, process, renderProcessLabel( commandArray[0] ) );
+
+ postExec(options, daemonEvents, launch, process);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected abstract boolean preExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents);
+
+ protected abstract void postExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents, ILaunch launch, Process process);
+
+ /**
+ * This code was adapted from code written by QNX Software Systems and others
+ * and was originally in the CDT under LocalCDILaunchDelegate::exec
+ *
+ * @param cmdLine
+ * the command line
+ * @param workingDirectory
+ * the working directory, or <code>null</code>
+ * @return the resulting process or <code>null</code> if the exec is
+ * cancelled
+ * @see Runtime
+ */
+ protected Process exec( String[] cmdLine, String[] environ, File workingDirectory, boolean usePty ) throws CoreException, IOException {
+ Process p = null;
+ try {
+ if ( workingDirectory == null ) {
+ p = ProcessFactory.getFactory().exec( cmdLine, environ );
+ }
+ else {
+ if ( usePty && PTY.isSupported() ) {
+ p = ProcessFactory.getFactory().exec( cmdLine, environ, workingDirectory, new PTY() );
+ }
+ else {
+ p = ProcessFactory.getFactory().exec( cmdLine, environ, workingDirectory );
+ }
+ }
+ }
+ catch( IOException e ) {
+ if ( p != null ) {
+ p.destroy();
+ }
+ throw e;
+ }
+ return p;
+ }
+
+ @Override
+ protected String getPluginID() {
+ return OprofileLaunchPlugin.getUniqueIdentifier();
+ }
+
+ //Helper function to refresh the oprofile view. Opens and focuses the view
+ // if it isn't already.
+ protected void refreshOprofileView() {
+ OprofileView view = OprofileUiPlugin.getDefault().getOprofileView();
+ if (view != null) {
+ view.refreshView();
+ } else {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(OprofileUiPlugin.ID_OPROFILE_VIEW);
+ } catch (PartInitException e2) {
+ e2.printStackTrace();
+ }
+ OprofileUiPlugin.getDefault().getOprofileView().refreshView();
+ }
+ }
+
+ /* all these functions exist to be overridden by the test class in order to allow launch testing */
+
+ protected void oprofileShutdown() throws OpcontrolException {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().shutdownDaemon();
+ }
+
+ protected void oprofileReset() throws OpcontrolException {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().reset();
+ }
+
+ protected void oprofileSetupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) throws OpcontrolException {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().setupDaemon(options, events);
+ }
+
+ protected void oprofileStartCollection() throws OpcontrolException {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().startCollection();
+ }
+
+ protected void oprofileDumpSamples() throws OpcontrolException {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().dumpSamples();
+ }
+
+ /**
+ * Runs opcontrol --help. Returns true if there was any output, false
+ * otherwise. Return value can be used to tell if the user successfully
+ * entered a password.
+ * @return true if opcontrol --help was run correctly. False otherwise
+ * @throws OpcontrolException
+ */
+ protected boolean oprofileStatus() throws OpcontrolException {
+ return OprofileCorePlugin.getDefault().getOpcontrolProvider().status();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchConfigurationDelegate.java
new file mode 100644
index 0000000000..dc0994b970
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchConfigurationDelegate.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc. and others
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.launching;
+
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.swt.widgets.Display;
+
+public class OprofileLaunchConfigurationDelegate extends AbstractOprofileLaunchConfigurationDelegate {
+
+ @Override
+ protected boolean preExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents) {
+ //set up and launch the oprofile daemon
+ try {
+ if (!oprofileStatus())
+ return false;
+
+ //kill the daemon (it shouldn't be running already, but to be safe)
+ oprofileShutdown();
+
+ //reset data from the (possibly) existing default session,
+ // otherwise multiple runs will combine samples and results
+ // won't make much sense
+ oprofileReset();
+
+ //setup the events and other parameters
+ oprofileSetupDaemon(options.getOprofileDaemonOptions(), daemonEvents);
+
+ //start the daemon & collection of samples
+ //note: since the daemon is only profiling for the specific image we told
+ // it to, no matter to start the daemon before the binary itself is run
+ oprofileStartCollection();
+ } catch (OpcontrolException oe) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void postExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents, ILaunch launch, Process process) {
+ //add a listener for termination of the launch
+ ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager();
+ lmgr.addLaunchListener(new LaunchTerminationWatcher(launch));
+ }
+
+ //A class used to listen for the termination of the current launch, and
+ // run some functions when it is finished.
+ class LaunchTerminationWatcher implements ILaunchesListener2 {
+ private ILaunch launch;
+ public LaunchTerminationWatcher(ILaunch il) {
+ launch = il;
+ }
+ public void launchesTerminated(ILaunch[] launches) {
+ try {
+ for (ILaunch l : launches) {
+ /**
+ * Dump samples from the daemon,
+ * shut down the daemon,
+ * activate the OProfile view (open it if it isn't already),
+ * refresh the view (which parses the data/ui model and displays it).
+ */
+ if (l.equals(launch)) {
+ oprofileDumpSamples();
+ oprofileShutdown();
+
+ //need to run this in the ui thread otherwise get SWT Exceptions
+ // based on concurrency issues
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ refreshOprofileView();
+ }
+ });
+ }
+ }
+ } catch (OpcontrolException oe) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ }
+ }
+ public void launchesAdded(ILaunch[] launches) { /* dont care */}
+ public void launchesChanged(ILaunch[] launches) { /* dont care */ }
+ public void launchesRemoved(ILaunch[] launches) { /* dont care */ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchShortcut.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchShortcut.java
new file mode 100644
index 0000000000..6bbe26c369
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileLaunchShortcut.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.launching;
+
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
+
+/**
+ * A class that takes care of the right-click -> profile with oprofile
+ * shortcut, where the ProfileLaunchShortcut has the logic to automatically
+ * find binaries and create a default launch if one doesn't exist.
+ */
+public class OprofileLaunchShortcut extends ProfileLaunchShortcut {
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+
+ return getLaunchManager().getLaunchConfigurationType(OprofileLaunchPlugin.ID_LAUNCH_PROFILE);
+ }
+
+ /**
+ * Default settings for the OProfile-specific option tabs.
+ */
+ @Override
+ protected void setDefaultProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
+ //default global setup options
+ LaunchOptions options = new LaunchOptions();
+ options.saveConfiguration(wc);
+
+ //default event option
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, true);
+ }
+
+ //need to have this here because a saved launch config will have the manual
+ // attribute left over, and a previous manual run will still run manually
+ // even if launched from the non-manual shortcut
+ @Override
+ protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
+ ILaunchConfiguration config = super.findLaunchConfiguration(bin, mode);
+
+ try {
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_MANUAL_PROFILE, false);
+ wc.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return config;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchConfigurationDelegate.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchConfigurationDelegate.java
new file mode 100644
index 0000000000..8f4cea4790
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchConfigurationDelegate.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc. and others
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.launching;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchesListener2;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchMessages;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.oprofile.ui.view.OprofileViewSaveDefaultSessionAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+public class OprofileManualLaunchConfigurationDelegate extends AbstractOprofileLaunchConfigurationDelegate {
+ @Override
+ protected boolean preExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents) {
+// //set up the oprofile daemon
+// try {
+// //kill the daemon (it shouldn't be running already, but to be safe)
+// oprofileShutdown();
+//
+// //reset data from the (possibly) existing default session,
+// // otherwise multiple runs will combine samples and results
+// // won't make much sense
+// oprofileReset();
+//
+// //setup the events and other parameters
+// oprofileSetupDaemon(options.getOprofileDaemonOptions(), daemonEvents);
+// } catch (OpcontrolException oe) {
+// OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+// return;
+// }
+ return true;
+ }
+
+ @Override
+ protected void postExec(LaunchOptions options, OprofileDaemonEvent[] daemonEvents, ILaunch launch, Process process) {
+ final LaunchOptions fOptions = options;
+ final OprofileDaemonEvent[] fDaemonEvents = daemonEvents;
+ final ILaunch fLaunch = launch;
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ //TODO: have a initialization dialog to do reset and setupDaemon?
+ // using a progress dialog, can't abort the launch if there's an exception..
+ try {
+ if (!oprofileStatus())
+ return;
+ oprofileReset();
+ oprofileSetupDaemon(fOptions.getOprofileDaemonOptions(), fDaemonEvents);
+ } catch (OpcontrolException oe) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ return; //dont open the dialog
+ }
+
+ //manual oprofile control dialog
+ final OprofiledControlDialog dlg = new OprofiledControlDialog();
+ ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager();
+
+ //possible for the launched process to have terminated before opening the dialog
+ if (!fLaunch.isTerminated()) {
+ dlg.setBlockOnOpen(false);
+ dlg.open();
+ lmgr.addLaunchListener(new LaunchTerminationDialogCloser(fLaunch, dlg));
+ }
+ }
+ });
+ }
+
+ //A class used to listen for the termination of the current launch, and
+ // run some functions when it is finished.
+ class LaunchTerminationDialogCloser implements ILaunchesListener2 {
+ private ILaunch launch;
+ private OprofiledControlDialog dialog;
+ public LaunchTerminationDialogCloser(ILaunch il, OprofiledControlDialog dlg) {
+ launch = il;
+ dialog = dlg;
+ }
+ public void launchesTerminated(ILaunch[] launches) {
+ for (ILaunch l : launches) {
+ //kill the dialog when the launch is done
+ if (l.equals(launch)) {
+ //must be in the ui thread else thread access errors
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ dialog.close();
+
+ //progress dialog for ensuring the daemon is shut down
+ IRunnableWithProgress refreshRunner = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(OprofileLaunchMessages.getString("oprofiledcontroldialog.post.stopdaemon"), 1); //$NON-NLS-1$
+ try {
+ oprofileShutdown();
+ } catch (OpcontrolException e) {
+// e.printStackTrace();
+ }
+ monitor.worked(1);
+ monitor.done();
+ }
+ };
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
+ try {
+ dialog.run(true, false, refreshRunner);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+ }
+ }
+ public void launchesAdded(ILaunch[] launches) { /* dont care */}
+ public void launchesChanged(ILaunch[] launches) { /* dont care */ }
+ public void launchesRemoved(ILaunch[] launches) { /* dont care */ }
+ }
+
+ /**
+ * A custom dialog box to control the oprofile daemon.
+ */
+ private class OprofiledControlDialog extends MessageDialog {
+ private Button _startDaemonButton;
+ private Button _stopDaemonButton;
+ private Button _refreshViewButton;
+ private Button _resetSessionButton;
+ private Button _saveSessionButton;
+ private List _feedbackList;
+
+ public OprofiledControlDialog () {
+ super(new Shell(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()), OprofileLaunchMessages.getString("oprofiledcontroldialog.title"), null, null, MessageDialog.NONE, new String[] { IDialogConstants.OK_LABEL }, 0); //$NON-NLS-1$
+
+ //override styles; makes the dialog non-modal
+ setShellStyle(SWT.CLOSE | SWT.TITLE );
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+ Composite area = new Composite(parent, 0);
+ Layout layout = new GridLayout(5, true);
+ GridData gd = new GridData();
+
+ area.setLayout(layout);
+ area.setLayoutData(gd);
+
+ Button startDaemonButton = new Button(area, SWT.PUSH);
+ startDaemonButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ startDaemonButton.setText(OprofileLaunchMessages.getString("oprofiledcontroldialog.buttons.startdaemon")); //$NON-NLS-1$
+ startDaemonButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ oprofileStartCollection();
+ _startDaemonButton.setEnabled(false);
+ _stopDaemonButton.setEnabled(true);
+ _refreshViewButton.setEnabled(true);
+ _resetSessionButton.setEnabled(true);
+ _saveSessionButton.setEnabled(true);
+ } catch (OpcontrolException oe) {
+ //disable buttons, notify user of error
+ disableAllButtons();
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ }
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.startdaemon")); //$NON-NLS-1$
+ }});
+ _startDaemonButton = startDaemonButton;
+
+ Button stopDaemonButton = new Button(area, SWT.PUSH);
+ stopDaemonButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ stopDaemonButton.setText(OprofileLaunchMessages.getString("oprofiledcontroldialog.buttons.stopdaemon")); //$NON-NLS-1$
+ stopDaemonButton.setEnabled(false); //disabled at start
+ stopDaemonButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ oprofileShutdown();
+ _startDaemonButton.setEnabled(true);
+ _stopDaemonButton.setEnabled(false);
+ } catch (OpcontrolException oe) {
+ //disable buttons, notify user of error
+ disableAllButtons();
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ }
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.stopdaemon")); //$NON-NLS-1$
+ }});
+ _stopDaemonButton = stopDaemonButton;
+
+ Button saveSessionButton = new Button(area, SWT.PUSH);
+ saveSessionButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ saveSessionButton.setText(OprofileLaunchMessages.getString("oprofiledcontroldialog.buttons.savesession")); //$NON-NLS-1$
+ saveSessionButton.setEnabled(false); //disabled at start
+ saveSessionButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.save")); //$NON-NLS-1$
+ OprofileViewSaveDefaultSessionAction hack = new OprofileViewSaveDefaultSessionAction();
+ hack.run();
+ }});
+ _saveSessionButton = saveSessionButton;
+
+ Button resetSessionButton = new Button(area, SWT.PUSH);
+ resetSessionButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ resetSessionButton.setText(OprofileLaunchMessages.getString("oprofiledcontroldialog.buttons.resetsession")); //$NON-NLS-1$
+ resetSessionButton.setEnabled(false); //disabled at start
+ resetSessionButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ oprofileReset();
+ } catch (OpcontrolException oe) {
+ //disable buttons, notify user of error
+ disableAllButtons();
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ }
+ refreshOprofileView(); //without refresh can lead to inconsistencies for save session
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.reset")); //$NON-NLS-1$
+ }});
+ _resetSessionButton = resetSessionButton;
+
+ Button refreshViewButton = new Button(area, SWT.PUSH);
+ refreshViewButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ refreshViewButton.setText(OprofileLaunchMessages.getString("oprofiledcontroldialog.buttons.refreshview")); //$NON-NLS-1$
+ refreshViewButton.setEnabled(false); //disabled at start
+ refreshViewButton.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ public void widgetSelected(SelectionEvent e) {
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.dumpsamples")); //$NON-NLS-1$
+ try {
+ oprofileDumpSamples();
+ } catch (OpcontrolException oe) {
+ //no error in this case; the user might refresh when the daemon isnt running
+ }
+ refreshOprofileView();
+ addToFeedbackList(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.refreshed")); //$NON-NLS-1$
+ }});
+ _refreshViewButton = refreshViewButton;
+
+
+ List feedback = new List(area, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
+ feedback.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
+ feedback.add(OprofileLaunchMessages.getString("oprofiledcontroldialog.feedback.init")); //$NON-NLS-1$
+ _feedbackList = feedback;
+
+ return area;
+ }
+
+ //helper function
+ private void disableAllButtons() {
+ _startDaemonButton.setEnabled(false);
+ _stopDaemonButton.setEnabled(false);
+ _refreshViewButton.setEnabled(false);
+ _resetSessionButton.setEnabled(false);
+ _saveSessionButton.setEnabled(false);
+ }
+
+ //a little hack to get the list to auto scroll to the newly added item
+ private void addToFeedbackList(String s) {
+ _feedbackList.add(s,0);
+ _feedbackList.setTopIndex(0);
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchShortcut.java b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchShortcut.java
new file mode 100644
index 0000000000..04f4091cdb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/launching/OprofileManualLaunchShortcut.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.launch.launching;
+
+import org.eclipse.cdt.core.model.IBinary;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
+import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
+import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
+
+/**
+ * A class that takes care of the right-click -> profile with oprofile
+ * shortcut, where the ProfileLaunchShortcut has the logic to automatically
+ * find binaries and create a default launch if one doesn't exist.
+ */
+public class OprofileManualLaunchShortcut extends ProfileLaunchShortcut {
+ @Override
+ protected ILaunchConfigurationType getLaunchConfigType() {
+ return getLaunchManager().getLaunchConfigurationType(OprofileLaunchPlugin.ID_LAUNCH_PROFILE_MANUAL);
+ }
+
+ /**
+ * Default settings for the OProfile-specific option tabs.
+ */
+ @Override
+ protected void setDefaultProfileAttributes(ILaunchConfigurationWorkingCopy wc) throws CoreException {
+ //default global setup options
+ LaunchOptions options = new LaunchOptions();
+ options.saveConfiguration(wc);
+
+ //default event option
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, true);
+ }
+
+ @Override
+ protected ILaunchConfiguration findLaunchConfiguration(IBinary bin, String mode) {
+ ILaunchConfiguration config = super.findLaunchConfiguration(bin, mode);
+
+ //hijack the launch config and add in the manual profile value, which will be
+ // used in the delegate
+ try {
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute(OprofileLaunchPlugin.ATTR_MANUAL_PROFILE, true);
+ wc.doSave();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ return config;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/oprofilelaunch.properties b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/oprofilelaunch.properties
new file mode 100644
index 0000000000..5b7ca9c0da
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.launch/src/org/eclipse/linuxtools/oprofile/launch/oprofilelaunch.properties
@@ -0,0 +1,68 @@
+#####################################################################
+# Copyright (c) 2004,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:
+# Keith Seitz <keiths@redhat.com> - initial implementation
+# Kent Sebastian <ksebasti@redhat.com> -
+######################################################################
+tab.claunch.name=&Application
+tab.claunch.launchConfig.label.text=C/C++ Launch &Configuration:
+tab.claunch.launchConfig.button.browse.text=&Browse...
+tab.claunch.launchConfigDialog.title=Launch Configuration Selection
+tab.claunch.launchConfigDialog.message=Choose a C/C++ Application Launch Configuration to profile:
+oprofileCounter.counterString=Counter: {0,number,integer}
+
+tab.event.name=Events
+tab.event.counterSettings.label.text=Counter settings
+tab.event.counterSettings.enabled.button.text=Enabled
+tab.event.eventDescription.label.text=Event Description:
+tab.event.counterSettings.profileKernel.check.text=Profile kernel
+tab.event.counterSettings.profileUser.check.text=Profile user binaries
+tab.event.counterSettings.count.label.text=Count:
+tab.event.counterSettings.count.too-small=Minimum count must be at least {0,number,integer}
+tab.event.counterSettings.count.invalid=Invalid count value, must be an integer
+tab.event.defaultevent.button.text=Use default event
+tab.event.counterTab.counterText=Ctr
+tab.event.timermode.no.options=OProfile is running in timer mode; no event options can be specified.
+
+tab.global.name=Global
+tab.global.kernelImage.label.text=&Kernel image file (optional):
+tab.global.kernelImage.kernel.nonexistent=Kernel image \"{0}\" does not exist
+tab.global.kernelImage.browse.button.text=&Browse...
+tab.global.selectKernelDialog.text=Select current kernel file
+tab.global.selectKernelDialog.error.kernelDoesNotExist.text=The selected kernel image file does not exist.
+tab.global.check.separateLibrary.text=Include dependent shared libraries
+tab.global.check.separateKernel.text=Include dependent kernel modules (also includes libraries)
+tab.global.check.separateThread.text=Separate profiles per thread
+tab.global.check.separateCpu.text=Separate profiles per CPU
+tab.global.check.manualProfile.text=Manual control of OProfile daemon
+
+unitmaskViewer.label.text=Unit mask:
+
+launchshortcut.no_project_error=No project associated with selected element.
+launchshortcut.errordialog.title=OProfile Launcher
+launchshortcut.errordialog.no_launch_error=Error: No launch configurations exist for this project.
+
+launchshortcut.launchselectiondialog.no_project_name=<no name>
+launchshortcut.launchselectiondialog.title=Profile Configuration Selection
+launchshortcut.launchselectiondialog.message=Select a profiling launch configuration:
+
+oprofiledcontroldialog.title=OProfile Control
+oprofiledcontroldialog.buttons.startdaemon=Start Daemon
+oprofiledcontroldialog.buttons.stopdaemon=Stop Daemon
+oprofiledcontroldialog.buttons.refreshview=Refresh View
+oprofiledcontroldialog.buttons.resetsession=Reset Session
+oprofiledcontroldialog.buttons.savesession=Save Session
+oprofiledcontroldialog.feedback.init=Dialog initialized
+oprofiledcontroldialog.feedback.startdaemon=Started OProfile daemon
+oprofiledcontroldialog.feedback.stopdaemon=Stopped OProfile daemon
+oprofiledcontroldialog.feedback.reset=Default session cleared
+oprofiledcontroldialog.feedback.save=Opening session save dialog..
+oprofiledcontroldialog.feedback.dumpsamples=Dumping samples..
+oprofiledcontroldialog.feedback.refreshed=OProfile view refreshed
+
+oprofiledcontroldialog.post.stopdaemon=Ensuring the OProfile daemon is stopped..
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/.project b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/.project
new file mode 100644
index 0000000000..381682716e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.test-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/oprofile/org.eclipse.linuxtools.oprofile.test-feature/ChangeLog b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/ChangeLog
new file mode 100644
index 0000000000..8a0876f072
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/ChangeLog
@@ -0,0 +1,18 @@
+2010-05-18 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Fix provider name.
+
+2010-04-26 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Match consistent license text (bug #306627). Update
+ copyright year.
+ * license.html: New file. HTML version of SUA (bug #306627).
+ * build.properties: Include license.html.
+
+2010-04-12 Andrew Overholt <overholt@redhat.com>
+
+ * feature.properties: Match consistent license text (bug #306627).
+
+2009-07-22 Andrew Overholt <overholt@redhat.com>
+
+ * feature.xml: Remove trailing "-feature". \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/build.properties
new file mode 100644
index 0000000000..67d433b5e2
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/build.properties
@@ -0,0 +1,9 @@
+bin.includes = feature.xml,\
+ epl-v10.html,\
+ feature.properties,\
+ license.html
+src.includes = feature.xml,\
+ feature.properties,\
+ epl-v10.html,\
+ build.properties,\
+ license.html
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/epl-v10.html b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/epl-v10.html
new file mode 100644
index 0000000000..9321f4082e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/epl-v10.html
@@ -0,0 +1,256 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Eclipse Public License - Version 1.0</title>
+
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style></head><body lang="EN-US">
+
+<p align="center"><b>Eclipse Public License - v 1.0</b></p>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body></html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.properties b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.properties
new file mode 100644
index 0000000000..96de94220d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.properties
@@ -0,0 +1,138 @@
+#*******************************************************************************
+# Copyright (c) 2009 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=OProfile Integration Tests (Incubation)
+featureProvider=Eclipse Linux Tools
+description=Tests for plugins bringing OProfile-based profiling into the workbench.
+copyright=Copyright 2008, 2010 Red Hat, Inc.
+licenseURL=license.html
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\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\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this 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 Foundation source code\n\
+repository ("Repository") in software 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\
+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\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update 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" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your 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\
+ - 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\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\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, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.xml b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.xml
new file mode 100644
index 0000000000..0c6731d67d
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/feature.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.linuxtools.oprofile.test"
+ label="%featureName"
+ version="0.3.0.qualifier"
+ provider-name="%featureProvider">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources" version="3.4.1" match="greaterOrEqual"/>
+ <import plugin="org.junit" version="3.8.2" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.oprofile.core"/>
+ <import plugin="org.eclipse.cdt.core"/>
+ <import plugin="org.eclipse.cdt.launch"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.linuxtools.oprofile.launch"/>
+ <import plugin="org.eclipse.linuxtools.profiling.tests"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.eclipse.core.runtime" version="3.4.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.linuxtools.oprofile.ui"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.core.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.launch.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.linuxtools.oprofile.ui.tests"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+</feature>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.test-feature/license.html b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/license.html
new file mode 100644
index 0000000000..c184ca36a9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.test-feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.tests/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/.project b/oprofile/org.eclipse.linuxtools.oprofile.tests/.project
new file mode 100644
index 0000000000..c8e31b70bf
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.tests</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..36670fa378
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Tue Mar 17 16:20:27 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.tests/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..d2117d7435
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.tests
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: %bundleProvider
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.linuxtools.oprofile.core.model,
+ org.eclipse.linuxtools.oprofile.core.opxml,
+ org.eclipse.linuxtools.oprofile.core.opxml.modeldata
+Export-Package: org.eclipse.linuxtools.oprofile.tests
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.linuxtools.oprofile.tests.TestPlugin
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.tests/build.properties
new file mode 100644
index 0000000000..f935d6e637
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ resources/,\
+ plugin.properties
+src.includes = src/,\
+ resources/,\
+ plugin.properties,\
+ META-INF/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.tests/plugin.properties
new file mode 100644
index 0000000000..c32eb1edf5
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/plugin.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# Copyright (c) 2009 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Common Test Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data.xml b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data.xml
new file mode 100644
index 0000000000..0942fa76e0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model-data>
+ <image name="/test/path/for/image" count="205000">
+ <symbols>
+ <symbol name="TestFunction1(int)" file="/test/path/for/src/image.cpp" count="180000">
+ <sample>
+ <count>130000</count>
+ <line>42</line>
+ </sample>
+ <sample>
+ <count>40000</count>
+ <line>36</line>
+ </sample>
+ <sample>
+ <count>9999</count>
+ <line>31</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>39</line>
+ </sample>
+ </symbol>
+ <symbol name="TestFunction2(int, int)" file="/test/path/for/src/image2.cpp" count="20000">
+ <sample>
+ <count>19998</count>
+ <line>94</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>12</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>55</line>
+ </sample>
+ </symbol>
+ </symbols>
+ <dependent count="5000">
+ <image name="/no-vmlinux" count="4400">
+ </image>
+ <image name="/lib64/ld-2.9.so" count="300">
+ <symbols>
+ <symbol name="do_lookup_x" file="dl-lookup.c" count="299">
+ <sample>
+ <count>299</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_unload_cache" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/usr/lib64/libstdc++.so.6.0.10" count="160">
+ </image>
+ <image name="/lib64/libc-2.9.so" count="140">
+ <symbols>
+ <symbol name="_IO_new_file_seekoff" file="" count="100">
+ <sample>
+ <count>100</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="bcopy" file="" count="40">
+ <sample>
+ <count>40</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ </dependent>
+ </image>
+</model-data> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_multiple_image.xml b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_multiple_image.xml
new file mode 100644
index 0000000000..e82dad5077
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_multiple_image.xml
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model-data>
+ <image name="/no-vmlinux" count="6844">
+ </image>
+ <image name="/bin/grep" count="2">
+ </image>
+ <image name="/bin/gawk" count="8">
+ </image>
+ <image name="/bin/bash" count="142">
+ </image>
+ <image name="/lib64/libgobject-2.0.so.0.1800.3" count="61">
+ </image>
+ <image name="/lib64/libgio-2.0.so.0.1800.3" count="2">
+ </image>
+ <image name="/lib64/libdl-2.9.so" count="2">
+ <symbols>
+ <symbol name="__do_global_dtors_aux" file="crtstuff.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/ld-2.9.so" count="36">
+ <symbols>
+ <symbol name="_dl_start" file="rtld.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="dl_main" file="rtld.c" count="3">
+ <sample>
+ <count>3</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="init_tls" file="rtld.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="open_verify" file="dl-load.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_setup_hash" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_init_internal" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_important_hwcaps" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="munmap" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_load_cache_lookup" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_fini" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__GI_memset" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_init_paths" file="rawmemchr.c" count="3">
+ <sample>
+ <count>3</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__brk" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_name_match_p" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="index" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_resolve_conflicts" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_cache_libcmp" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="strcmp" file="rawmemchr.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_start_user" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="strlen" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_sort_fini" file="rawmemchr.c" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="_dl_map_object_deps" file="rawmemchr.c" count="4">
+ <sample>
+ <count>4</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ <symbol name="__libc_memalign" file="" count="1">
+ <sample>
+ <count>1</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/libdbus-1.so.3.4.0" count="10">
+ </image>
+ <image name="/lib64/libfuse.so.2.7.4" count="1">
+ </image>
+ <image name="/lib64/libm-2.9.so" count="2">
+ <symbols>
+ <symbol name="__dubsin" file="interp.c" count="2">
+ <sample>
+ <count>2</count>
+ <line>0</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+ <image name="/lib64/libglib-2.0.so.0.1800.3" count="107">
+ </image>
+ <image name="/lib64/libgthread-2.0.so.0.1800.3" count="3">
+ </image>
+ <image name="/usr/bin/which" count="1">
+ </image>
+ <image name="/usr/bin/compiz" count="21">
+ </image>
+ <image name="/usr/bin/Xorg" count="154">
+ <dependent count="6">
+ <image name="[vdso]" count="6">
+ </image>
+ </dependent>
+ </image>
+ <image name="/usr/bin/ophelp" count="11">
+ </image>
+ <image name="/usr/bin/qemu-kvm" count="142">
+ <dependent count="1">
+ <image name="[vdso]" count="1">
+ </image>
+ </dependent>
+ </image>
+ <image name="/usr/bin/oprofiled" count="26">
+ </image>
+ <image name="/usr/sbin/libvirtd" count="3">
+ </image>
+ <image name="/usr/libexec/multiload-applet-2" count="1">
+ </image>
+ <image name="/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server/libjvm.so" count="7">
+ </image>
+ <image name="/usr/lib64/libgtk-x11-2.0.so.0.1400.5" count="22">
+ </image>
+ <image name="/usr/lib64/libpangocairo-1.0.so.0.2203.0" count="4">
+ </image>
+ <image name="/usr/lib64/libXrender.so.1.3.0" count="2">
+ </image>
+</model-data> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_nodepimage.xml b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_nodepimage.xml
new file mode 100644
index 0000000000..e01389dbc4
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/resources/test_model-data_nodepimage.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model-data>
+ <image name="/test/path/for/image" count="200000">
+ <symbols>
+ <symbol name="TestFunction1(int)" file="/test/path/for/src/image.cpp" count="180000">
+ <sample>
+ <count>130000</count>
+ <line>42</line>
+ </sample>
+ <sample>
+ <count>40000</count>
+ <line>36</line>
+ </sample>
+ <sample>
+ <count>9999</count>
+ <line>31</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>39</line>
+ </sample>
+ </symbol>
+ <symbol name="TestFunction2(int, int)" file="/test/path/for/src/image2.cpp" count="20000">
+ <sample>
+ <count>19998</count>
+ <line>94</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>12</line>
+ </sample>
+ <sample>
+ <count>1</count>
+ <line>55</line>
+ </sample>
+ </symbol>
+ </symbols>
+ </image>
+</model-data> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestPlugin.java
new file mode 100644
index 0000000000..8b87d1d01e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestPlugin.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class TestPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.tests"; //$NON-NLS-1$
+
+ public static final String SYMBOL1_FILENAME = "/test/path/for/src/image.cpp"; //$NON-NLS-1$
+ public static final String SYMBOL2_FILENAME = "/test/path/for/src/image2.cpp"; //$NON-NLS-1$
+
+ public static final String DEP2_SYMBOL1_FILENAME = "dl-lookup.c"; //$NON-NLS-1$
+ public static final String DEP2_SYMBOL2_FILENAME = "rawmemchr.c"; //$NON-NLS-1$
+ public static final String DEP4_SYMBOL_FILENAME = ""; //$NON-NLS-1$
+
+ // The shared instance
+ private static TestPlugin plugin = null;
+
+ /**
+ * The constructor
+ */
+ public TestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ 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)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelRoot.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelRoot.java
new file mode 100644
index 0000000000..f993102a33
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelRoot.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+
+public class TestingOpModelRoot extends OpModelRoot {
+ public static final String ROOT_OUTPUT = "Event: testEvent1\n\tSession: testSession1e1\n\t\tImage: /test/path/for/image, Count: 205000, Dependent Count: 5000\n\t\t\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\t\t\tSample: Line #: 42, Count: 130000\n\t\t\t\tSample: Line #: 36, Count: 40000\n\t\t\t\tSample: Line #: 31, Count: 9999\n\t\t\t\tSample: Line #: 39, Count: 1\n\t\t\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\t\t\tSample: Line #: 94, Count: 19998\n\t\t\t\tSample: Line #: 12, Count: 1\n\t\t\t\tSample: Line #: 55, Count: 1\n\t\t\tDependent Image: /no-vmlinux, Count: 4400\n\t\t\tDependent Image: /lib64/ld-2.9.so, Count: 300\n\t\t\t\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\t\t\t\tSample: Line #: 0, Count: 299\n\t\t\t\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\t\t\t\tSample: Line #: 0, Count: 1\n\t\t\tDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\n\t\t\tDependent Image: /lib64/libc-2.9.so, Count: 140\n\t\t\t\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\t\t\t\tSample: Line #: 0, Count: 100\n\t\t\t\tSymbols: bcopy, File: , Count: 40\n\t\t\t\t\tSample: Line #: 0, Count: 40\nEvent: testEvent2\n\tSession: testSession1e2\n\t\tImage: /test/path/for/image, Count: 205000, Dependent Count: 5000\n\t\t\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\t\t\tSample: Line #: 42, Count: 130000\n\t\t\t\tSample: Line #: 36, Count: 40000\n\t\t\t\tSample: Line #: 31, Count: 9999\n\t\t\t\tSample: Line #: 39, Count: 1\n\t\t\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\t\t\tSample: Line #: 94, Count: 19998\n\t\t\t\tSample: Line #: 12, Count: 1\n\t\t\t\tSample: Line #: 55, Count: 1\n\t\t\tDependent Image: /no-vmlinux, Count: 4400\n\t\t\tDependent Image: /lib64/ld-2.9.so, Count: 300\n\t\t\t\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\t\t\t\tSample: Line #: 0, Count: 299\n\t\t\t\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\t\t\t\tSample: Line #: 0, Count: 1\n\t\t\tDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\n\t\t\tDependent Image: /lib64/libc-2.9.so, Count: 140\n\t\t\t\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\t\t\t\tSample: Line #: 0, Count: 100\n\t\t\t\tSymbols: bcopy, File: , Count: 40\n\t\t\t\t\tSample: Line #: 0, Count: 40\n\tSession: testSession2e2\n\t\tImage: /test/path/for/image, Count: 200000\n\t\t\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\t\t\tSample: Line #: 42, Count: 130000\n\t\t\t\tSample: Line #: 36, Count: 40000\n\t\t\t\tSample: Line #: 31, Count: 9999\n\t\t\t\tSample: Line #: 39, Count: 1\n\t\t\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\t\t\tSample: Line #: 94, Count: 19998\n\t\t\t\tSample: Line #: 12, Count: 1\n\t\t\t\tSample: Line #: 55, Count: 1\n\tSession: testSession3e2\n\t\tImage: , Count: -1\n\tSession: testSession4e2\n"; //$NON-NLS-1$
+ public static final String NAME_E1 = "testEvent1"; //$NON-NLS-1$
+ public static final String NAME_E2 = "testEvent2"; //$NON-NLS-1$
+ public static final String NAME_E1_S1 = "testSession1e1"; //$NON-NLS-1$
+ public static final String NAME_E2_S1 = "testSession1e2"; //$NON-NLS-1$
+ public static final String NAME_E2_S2 = "testSession2e2"; //$NON-NLS-1$
+ public static final String NAME_E2_S3 = "testSession3e2"; //$NON-NLS-1$
+ public static final String NAME_E2_S4 = "testSession4e2"; //$NON-NLS-1$
+ @Override
+ protected OpModelEvent[] getNewEvents() {
+ //fake running opxml and simply return hand-made events
+ OpModelEvent[] e = {new OpModelEvent(NAME_E1), new OpModelEvent(NAME_E2), null};
+ e[0]._setSessions(new TestingOpModelSession[] {new TestingOpModelSession(e[0], NAME_E1_S1)});
+ e[1]._setSessions(new OpModelSession[] {
+ new TestingOpModelSession(e[1], NAME_E2_S1),
+ new TestingOpModelSession2(e[1], NAME_E2_S2),
+ new TestingOpModelSession3(e[1], NAME_E2_S3),
+ new TestingOpModelSession4(e[1], NAME_E2_S4)});
+ return e;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession.java
new file mode 100644
index 0000000000..cdeb612f3a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * A faked OpModelSession object of a typical image + some dependent images.
+ */
+public class TestingOpModelSession extends OpModelSession {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_model-data.xml"; //$NON-NLS-1$
+ public static final String IMAGE_OUTPUT = "/test/path/for/image, Count: 205000, Dependent Count: 5000\nSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\tSample: Line #: 42, Count: 130000\n\tSample: Line #: 36, Count: 40000\n\tSample: Line #: 31, Count: 9999\n\tSample: Line #: 39, Count: 1\nSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\tSample: Line #: 94, Count: 19998\n\tSample: Line #: 12, Count: 1\n\tSample: Line #: 55, Count: 1\nDependent Image: /no-vmlinux, Count: 4400\nDependent Image: /lib64/ld-2.9.so, Count: 300\n\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\tSample: Line #: 0, Count: 299\n\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\tSample: Line #: 0, Count: 1\nDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\nDependent Image: /lib64/libc-2.9.so, Count: 140\n\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\tSample: Line #: 0, Count: 100\n\tSymbols: bcopy, File: , Count: 40\n\t\tSample: Line #: 0, Count: 40\n"; //$NON-NLS-1$
+ public static final String IMAGE_OUTPUT_WITHTAB = "/test/path/for/image, Count: 205000, Dependent Count: 5000\n\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\tSample: Line #: 42, Count: 130000\n\t\tSample: Line #: 36, Count: 40000\n\t\tSample: Line #: 31, Count: 9999\n\t\tSample: Line #: 39, Count: 1\n\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\tSample: Line #: 94, Count: 19998\n\t\tSample: Line #: 12, Count: 1\n\t\tSample: Line #: 55, Count: 1\n\tDependent Image: /no-vmlinux, Count: 4400\n\tDependent Image: /lib64/ld-2.9.so, Count: 300\n\t\tSymbols: do_lookup_x, File: dl-lookup.c, Count: 299\n\t\t\tSample: Line #: 0, Count: 299\n\t\tSymbols: _dl_unload_cache, File: rawmemchr.c, Count: 1\n\t\t\tSample: Line #: 0, Count: 1\n\tDependent Image: /usr/lib64/libstdc++.so.6.0.10, Count: 160\n\tDependent Image: /lib64/libc-2.9.so, Count: 140\n\t\tSymbols: _IO_new_file_seekoff, File: , Count: 100\n\t\t\tSample: Line #: 0, Count: 100\n\t\tSymbols: bcopy, File: , Count: 40\n\t\t\tSample: Line #: 0, Count: 40\n"; //$NON-NLS-1$
+
+ public TestingOpModelSession(OpModelEvent event, String name) {
+ super(event, name);
+ }
+ @Override
+ protected OpModelImage getNewImage() {
+ /* this code mostly taken from OpxmlRunner */
+ OpModelImage parsedImage = null;
+ try {
+ XMLReader reader = null;
+ parsedImage = new OpModelImage();
+ ModelDataProcessor.CallData image = new ModelDataProcessor.CallData(parsedImage);
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(image);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(TestPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+
+ return parsedImage;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession2.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession2.java
new file mode 100644
index 0000000000..5f5adf2286
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession2.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * A faked OpModelSession object of a typical image with no dependent images.
+ */
+public class TestingOpModelSession2 extends OpModelSession {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_model-data_nodepimage.xml"; //$NON-NLS-1$
+ public static final String IMAGE_OUTPUT = "/test/path/for/image, Count: 205000, Dependent Count: 5000\nSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\tSample: Line #: 42, Count: 130000\n\tSample: Line #: 36, Count: 40000\n\tSample: Line #: 31, Count: 9999\n\tSample: Line #: 39, Count: 1\nSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\tSample: Line #: 94, Count: 19998\n\tSample: Line #: 12, Count: 1\n\tSample: Line #: 55, Count: 1\n"; //$NON-NLS-1$
+ public static final String IMAGE_OUTPUT_WITHTAB = "/test/path/for/image, Count: 205000, Dependent Count: 5000\n\tSymbols: TestFunction1(int), File: /test/path/for/src/image.cpp, Count: 180000\n\t\tSample: Line #: 42, Count: 130000\n\t\tSample: Line #: 36, Count: 40000\n\t\tSample: Line #: 31, Count: 9999\n\t\tSample: Line #: 39, Count: 1\n\tSymbols: TestFunction2(int, int), File: /test/path/for/src/image2.cpp, Count: 20000\n\t\tSample: Line #: 94, Count: 19998\n\t\tSample: Line #: 12, Count: 1\n\t\tSample: Line #: 55, Count: 1\n"; //$NON-NLS-1$
+
+ public TestingOpModelSession2(OpModelEvent event, String name) {
+ super(event, name);
+ }
+ @Override
+ protected OpModelImage getNewImage() {
+ /* this code mostly taken from OpxmlRunner */
+ OpModelImage parsedImage = null;
+ try {
+ XMLReader reader = null;
+ parsedImage = new OpModelImage();
+ ModelDataProcessor.CallData image = new ModelDataProcessor.CallData(parsedImage);
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(image);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(TestPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+
+ return parsedImage;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession3.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession3.java
new file mode 100644
index 0000000000..ccb5f6b013
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession3.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
+import org.eclipse.linuxtools.oprofile.core.opxml.modeldata.ModelDataProcessor;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * A faked OpModelSession object when there are multiple images in the session,
+ * simulating when the session was not created from within the eclipse plugin.
+ */
+public class TestingOpModelSession3 extends OpModelSession {
+ private static final String REL_PATH_TO_TEST_XML = "resources/test_model-data_multiple_image.xml"; //$NON-NLS-1$
+
+ public TestingOpModelSession3(OpModelEvent event, String name) {
+ super(event, name);
+ }
+ @Override
+ protected OpModelImage getNewImage() {
+ /* this code mostly taken from OpxmlRunner */
+ OpModelImage parsedImage = null;
+ try {
+ XMLReader reader = null;
+ parsedImage = new OpModelImage();
+ ModelDataProcessor.CallData image = new ModelDataProcessor.CallData(parsedImage);
+ OprofileSAXHandler handler = OprofileSAXHandler.getInstance(image);
+
+ // Create XMLReader
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ reader = factory.newSAXParser().getXMLReader();
+
+ // Set content/error handlers
+ reader.setContentHandler(handler);
+ reader.setErrorHandler(handler);
+
+ String filePath = FileLocator.toFileURL(FileLocator.find(TestPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
+ reader.parse(new InputSource(new FileReader(filePath)));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+
+ return parsedImage;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession4.java b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession4.java
new file mode 100644
index 0000000000..d5bc1358a2
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.tests/src/org/eclipse/linuxtools/oprofile/tests/TestingOpModelSession4.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.tests;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+
+/*
+ * A faked OpModelSession object where there is no image.
+ * Note: technically this shouldn't really happen in normal operation
+ * of the plugin unless there is a major b0rk-up with the xml parsers..
+ */
+public class TestingOpModelSession4 extends OpModelSession {
+ public TestingOpModelSession4(OpModelEvent event, String name) {
+ super(event, name);
+ }
+ @Override
+ protected OpModelImage getNewImage() {
+ return null;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.project b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.project
new file mode 100644
index 0000000000..cebd05a8ea
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.ui.tests</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..b8349f171f
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+#Tue Mar 17 15:14:26 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..9c5c7400fe
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.ui.tests
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.oprofile.ui.tests.UiTestsPlugin
+Bundle-Vendor: %bundleProvider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.4.1",
+ org.junit;bundle-version="3.8.2"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.linuxtools.oprofile.core.model,
+ org.eclipse.linuxtools.oprofile.tests,
+ org.eclipse.linuxtools.oprofile.ui.model,
+ org.eclipse.swt.graphics
+Bundle-Localization: plugin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/build.properties
new file mode 100644
index 0000000000..25b52ebaa0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ test.xml
+src.includes = META-INF/,\
+ plugin.properties,\
+ src/,\
+ test.xml
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/plugin.properties
new file mode 100644
index 0000000000..1d099e594c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/plugin.properties
@@ -0,0 +1,12 @@
+#*******************************************************************************
+# Copyright (c) 2009 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:
+# Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+#*******************************************************************************
+bundleName=OProfile Ui Tests Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/AllUiTests.java b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/AllUiTests.java
new file mode 100644
index 0000000000..81a3e9039e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/AllUiTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllUiTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.eclipse.linuxtools.oprofile.ui.tests"); //$NON-NLS-1$
+
+ suite.addTestSuite(TestUiDataModel.class);
+
+ return suite;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/TestUiDataModel.java b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/TestUiDataModel.java
new file mode 100644
index 0000000000..2e62ceaba2
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/TestUiDataModel.java
@@ -0,0 +1,678 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.tests.TestPlugin;
+import org.eclipse.linuxtools.oprofile.tests.TestingOpModelRoot;
+import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelRoot;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSample;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSession;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSymbol;
+
+public class TestUiDataModel extends TestCase {
+
+ private class TestingUiModelRoot extends UiModelRoot {
+ protected OpModelEvent[] getModelDataEvents() {
+ TestingOpModelRoot modelRoot = new TestingOpModelRoot();
+ modelRoot.refreshModel();
+ return modelRoot.getEvents();
+ };
+ }
+
+ private class TestingUiModelRoot2 extends UiModelRoot {
+ protected OpModelEvent[] getModelDataEvents() {
+ return null;
+ };
+ }
+
+ private TestingUiModelRoot _uiModelRoot;
+ private TestingUiModelRoot2 _uiModelRoot2;
+
+ public TestUiDataModel() {
+ super("test ui data model classes"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ _uiModelRoot = new TestingUiModelRoot();
+ _uiModelRoot.refreshModel();
+
+ _uiModelRoot2 = new TestingUiModelRoot2();
+ _uiModelRoot2.refreshModel();
+ }
+
+ public void testParse() {
+ /* test UiModelRoot */
+ assertNull(_uiModelRoot2.getLabelImage());
+ assertNull(_uiModelRoot2.getParent());
+ assertNull(_uiModelRoot2.getLabelText());
+ assertTrue(_uiModelRoot2.hasChildren());
+ IUiModelElement r2_events[] = _uiModelRoot2.getChildren();
+ assertNotNull(r2_events);
+ assertEquals(1, r2_events.length);
+ IUiModelElement r2_event1 = r2_events[0];
+ assertFalse(r2_event1.hasChildren());
+ assertNull(r2_event1.getChildren());
+ assertNull(r2_event1.getParent());
+ assertNotNull(r2_event1.getLabelImage());
+ assertNotNull(r2_event1.getLabelText());
+
+ assertNull(_uiModelRoot.getLabelImage());
+ assertNull(_uiModelRoot.getParent());
+ assertNull(_uiModelRoot.getLabelText());
+ assertTrue(_uiModelRoot.hasChildren());
+
+ /* test UiModelEvent */
+ IUiModelElement events[] = _uiModelRoot.getChildren();
+ assertNotNull(events);
+ assertEquals(3, events.length);
+ assertNotNull(events[0]);
+ assertNotNull(events[1]);
+ assertNotNull(events[2]);
+
+ assertEquals(TestingOpModelRoot.NAME_E1, events[0].toString());
+ assertEquals(TestingOpModelRoot.NAME_E1, events[0].getLabelText());
+ assertTrue(events[0].hasChildren());
+ assertNull(events[0].getParent()); //events are top level tree elements
+ assertNotNull(events[0].getLabelImage());
+
+ assertEquals(TestingOpModelRoot.NAME_E2, events[1].toString());
+ assertEquals(TestingOpModelRoot.NAME_E2, events[1].getLabelText());
+ assertTrue(events[1].hasChildren());
+ assertNull(events[1].getParent()); //events are top level tree elements
+ assertNotNull(events[1].getLabelImage());
+
+ assertEquals("", events[2].toString()); //$NON-NLS-1$
+ assertEquals("", events[2].getLabelText()); //$NON-NLS-1$
+ assertFalse(events[2].hasChildren());
+ assertNull(events[2].getParent()); //events are top level tree elements
+ assertNotNull(events[2].getLabelImage());
+
+ /* test UiModelSession */
+ IUiModelElement[] e1_sessions = events[0].getChildren(), e2_sessions = events[1].getChildren();
+ assertNotNull(e1_sessions);
+ assertNotNull(e2_sessions);
+ assertEquals(1, e1_sessions.length);
+ assertEquals(4, e2_sessions.length);
+ assertNotNull(e1_sessions[0]);
+ assertNotNull(e2_sessions[0]);
+ assertNotNull(e2_sessions[1]);
+ assertNotNull(e2_sessions[2]);
+ assertNotNull(e2_sessions[3]);
+
+ assertEquals(TestingOpModelRoot.NAME_E1_S1, e1_sessions[0].toString());
+ assertEquals(TestingOpModelRoot.NAME_E1_S1, e1_sessions[0].getLabelText());
+ assertFalse(((UiModelSession)e1_sessions[0]).isDefaultSession());
+ assertTrue(e1_sessions[0].hasChildren());
+ assertEquals(events[0], e1_sessions[0].getParent());
+ assertNotNull(e1_sessions[0].getLabelImage());
+
+ assertEquals(TestingOpModelRoot.NAME_E2_S1, e2_sessions[0].toString());
+ assertEquals(TestingOpModelRoot.NAME_E2_S1, e2_sessions[0].getLabelText());
+ assertFalse(((UiModelSession)e2_sessions[0]).isDefaultSession());
+ assertTrue(e2_sessions[0].hasChildren());
+ assertEquals(events[1], e2_sessions[0].getParent());
+ assertNotNull(e2_sessions[0].getLabelImage());
+
+ assertEquals(TestingOpModelRoot.NAME_E2_S2, e2_sessions[1].toString());
+ assertEquals(TestingOpModelRoot.NAME_E2_S2, e2_sessions[1].getLabelText());
+ assertFalse(((UiModelSession)e2_sessions[1]).isDefaultSession());
+ assertTrue(e2_sessions[1].hasChildren());
+ assertEquals(events[1], e2_sessions[1].getParent());
+ assertNotNull(e2_sessions[1].getLabelImage());
+
+ assertEquals(TestingOpModelRoot.NAME_E2_S3, e2_sessions[2].toString());
+ assertEquals(TestingOpModelRoot.NAME_E2_S3, e2_sessions[2].getLabelText());
+ assertFalse(((UiModelSession)e2_sessions[2]).isDefaultSession());
+ assertTrue(e2_sessions[2].hasChildren());
+ assertEquals(events[1], e2_sessions[2].getParent());
+ assertNotNull(e2_sessions[2].getLabelImage());
+
+ assertEquals(TestingOpModelRoot.NAME_E2_S4, e2_sessions[3].toString());
+ assertEquals(TestingOpModelRoot.NAME_E2_S4, e2_sessions[3].getLabelText());
+ assertFalse(((UiModelSession)e2_sessions[3]).isDefaultSession());
+ assertFalse(e2_sessions[3].hasChildren());
+ assertEquals(events[1], e2_sessions[3].getParent());
+ assertNotNull(e2_sessions[3].getLabelImage());
+
+ /* test UiModelImage and UiModelDependent */
+ IUiModelElement[] e1_s1_images = e1_sessions[0].getChildren(),
+ e2_s1_images = e2_sessions[0].getChildren(),
+ e2_s2_images = e2_sessions[1].getChildren(),
+ e2_s3_images = e2_sessions[2].getChildren(),
+ e2_s4_images = e2_sessions[3].getChildren();
+
+ assertNotNull(e1_s1_images);
+ assertNotNull(e2_s1_images);
+ assertNotNull(e2_s2_images);
+ assertNotNull(e2_s3_images);
+ assertNotNull(e2_s4_images);
+ assertEquals(2, e1_s1_images.length); //#2 is a dep image
+ assertEquals(2, e2_s1_images.length); //#2 is a dep image
+ assertEquals(1, e2_s2_images.length);
+ assertEquals(1, e2_s3_images.length);
+ assertEquals(1, e2_s4_images.length);
+ assertNotNull(e1_s1_images[0]);
+ assertNotNull(e1_s1_images[1]);
+ assertNotNull(e2_s1_images[0]);
+ assertNotNull(e2_s1_images[1]);
+ assertNotNull(e2_s2_images[0]);
+ assertNotNull(e2_s3_images[0]);
+ assertNull(e2_s4_images[0]);
+
+ //dont test string output -- strings are i18n'd and L10n'd
+ assertNotNull(e1_s1_images[0].toString());
+ assertNotNull(e1_s1_images[0].getLabelText());
+ assertTrue(e1_s1_images[0].hasChildren());
+ assertEquals(e1_sessions[0], e1_s1_images[0].getParent());
+ assertNotNull(e1_s1_images[0].getLabelImage());
+
+ assertNotNull(e1_s1_images[1].toString());
+ assertNotNull(e1_s1_images[1].getLabelText());
+ assertTrue(e1_s1_images[1].hasChildren());
+ assertEquals(e1_sessions[0], e1_s1_images[1].getParent());
+ assertNotNull(e1_s1_images[1].getLabelImage());
+
+ assertNotNull(e2_s1_images[0].toString());
+ assertNotNull(e2_s1_images[0].getLabelText());
+ assertTrue(e2_s1_images[0].hasChildren());
+ assertEquals(e2_sessions[0], e2_s1_images[0].getParent());
+ assertNotNull(e2_s1_images[0].getLabelImage());
+
+ assertNotNull(e2_s1_images[1].toString());
+ assertNotNull(e2_s1_images[1].getLabelText());
+ assertTrue(e2_s1_images[1].hasChildren());
+ assertEquals(e2_sessions[0], e2_s1_images[1].getParent());
+ assertNotNull(e2_s1_images[1].getLabelImage());
+
+ assertNotNull(e2_s2_images[0].toString());
+ assertNotNull(e2_s2_images[0].getLabelText());
+ assertTrue(e2_s2_images[0].hasChildren());
+ assertEquals(e2_sessions[1], e2_s2_images[0].getParent());
+ assertNotNull(e2_s2_images[0].getLabelImage());
+
+ assertNotNull(e2_s3_images[0].toString());
+ assertNotNull(e2_s3_images[0].getLabelText());
+ assertFalse(e2_s3_images[0].hasChildren());
+ assertEquals(e2_sessions[2], e2_s3_images[0].getParent());
+ assertNotNull(e2_s3_images[0].getLabelImage());
+
+ /* test UiModelSymbol */
+ IUiModelElement[] e1_s1_i1_symbols = e1_s1_images[0].getChildren(),
+ e1_s1_i2_depimages = e1_s1_images[1].getChildren(),
+ e2_s1_i1_symbols = e2_s1_images[0].getChildren(),
+ e2_s1_i2_depimages = e2_s1_images[1].getChildren(),
+ e2_s2_i1_symbols = e2_s2_images[0].getChildren();
+
+ assertNotNull(e1_s1_i1_symbols);
+ assertNotNull(e1_s1_i2_depimages);
+ assertNotNull(e2_s1_i1_symbols);
+ assertNotNull(e2_s1_i2_depimages);
+ assertNotNull(e2_s2_i1_symbols);
+ assertEquals(2, e1_s1_i1_symbols.length);
+ assertEquals(4, e1_s1_i2_depimages.length);
+ assertEquals(2, e2_s1_i1_symbols.length);
+ assertEquals(4, e2_s1_i2_depimages.length);
+ assertEquals(2, e2_s2_i1_symbols.length);
+ assertNotNull(e1_s1_i1_symbols[0]);
+ assertNotNull(e1_s1_i1_symbols[1]);
+ assertNotNull(e1_s1_i2_depimages[0]);
+ assertNotNull(e1_s1_i2_depimages[1]);
+ assertNotNull(e1_s1_i2_depimages[2]);
+ assertNotNull(e1_s1_i2_depimages[3]);
+ assertNotNull(e2_s1_i1_symbols[0]);
+ assertNotNull(e2_s1_i1_symbols[1]);
+ assertNotNull(e2_s1_i2_depimages[0]);
+ assertNotNull(e2_s1_i2_depimages[1]);
+ assertNotNull(e2_s1_i2_depimages[2]);
+ assertNotNull(e2_s1_i2_depimages[3]);
+ assertNotNull(e2_s2_i1_symbols[0]);
+ assertNotNull(e2_s2_i1_symbols[1]);
+
+ assertNotNull(e1_s1_i1_symbols[0].toString());
+ assertNotNull(e1_s1_i1_symbols[0].getLabelText());
+ assertEquals(TestPlugin.SYMBOL1_FILENAME, ((UiModelSymbol)e1_s1_i1_symbols[0]).getFileName());
+ assertTrue(e1_s1_i1_symbols[0].hasChildren());
+ assertEquals(e1_s1_images[0], e1_s1_i1_symbols[0].getParent());
+ assertNotNull(e1_s1_i1_symbols[0].getLabelImage());
+
+ assertNotNull(e1_s1_i1_symbols[1].toString());
+ assertNotNull(e1_s1_i1_symbols[1].getLabelText());
+ assertEquals(TestPlugin.SYMBOL2_FILENAME, ((UiModelSymbol)e1_s1_i1_symbols[1]).getFileName());
+ assertTrue(e1_s1_i1_symbols[1].hasChildren());
+ assertEquals(e1_s1_images[0], e1_s1_i1_symbols[1].getParent());
+ assertNotNull(e1_s1_i1_symbols[1].getLabelImage());
+
+ assertNotNull(e1_s1_i2_depimages[0].toString());
+ assertNotNull(e1_s1_i2_depimages[0].getLabelText());
+ assertFalse(e1_s1_i2_depimages[0].hasChildren());
+ assertEquals(e1_s1_images[1], e1_s1_i2_depimages[0].getParent());
+ assertNotNull(e1_s1_i2_depimages[0].getLabelImage());
+
+ assertNotNull(e1_s1_i2_depimages[1].toString());
+ assertNotNull(e1_s1_i2_depimages[1].getLabelText());
+ assertTrue(e1_s1_i2_depimages[1].hasChildren());
+ assertEquals(e1_s1_images[1], e1_s1_i2_depimages[1].getParent());
+ assertNotNull(e1_s1_i2_depimages[1].getLabelImage());
+
+ assertNotNull(e1_s1_i2_depimages[2].toString());
+ assertNotNull(e1_s1_i2_depimages[2].getLabelText());
+ assertFalse(e1_s1_i2_depimages[2].hasChildren());
+ assertEquals(e1_s1_images[1], e1_s1_i2_depimages[2].getParent());
+ assertNotNull(e1_s1_i2_depimages[2].getLabelImage());
+
+ assertNotNull(e1_s1_i2_depimages[3].toString());
+ assertNotNull(e1_s1_i2_depimages[3].getLabelText());
+ assertTrue(e1_s1_i2_depimages[3].hasChildren());
+ assertEquals(e1_s1_images[1], e1_s1_i2_depimages[3].getParent());
+ assertNotNull(e1_s1_i2_depimages[3].getLabelImage());
+
+ assertNotNull(e2_s1_i1_symbols[0].toString());
+ assertNotNull(e2_s1_i1_symbols[0].getLabelText());
+ assertEquals(TestPlugin.SYMBOL1_FILENAME, ((UiModelSymbol)e2_s1_i1_symbols[0]).getFileName());
+ assertTrue(e2_s1_i1_symbols[0].hasChildren());
+ assertEquals(e2_s1_images[0], e2_s1_i1_symbols[0].getParent());
+ assertNotNull(e2_s1_i1_symbols[0].getLabelImage());
+
+ assertNotNull(e2_s1_i1_symbols[1].toString());
+ assertNotNull(e2_s1_i1_symbols[1].getLabelText());
+ assertEquals(TestPlugin.SYMBOL2_FILENAME, ((UiModelSymbol)e2_s1_i1_symbols[1]).getFileName());
+ assertTrue(e2_s1_i1_symbols[1].hasChildren());
+ assertEquals(e2_s1_images[0], e2_s1_i1_symbols[1].getParent());
+ assertNotNull(e2_s1_i1_symbols[1].getLabelImage());
+
+ assertNotNull(e2_s1_i2_depimages[0].toString());
+ assertNotNull(e2_s1_i2_depimages[0].getLabelText());
+ assertFalse(e2_s1_i2_depimages[0].hasChildren());
+ assertEquals(e2_s1_images[1], e2_s1_i2_depimages[0].getParent());
+ assertNotNull(e2_s1_i2_depimages[0].getLabelImage());
+
+ assertNotNull(e2_s1_i2_depimages[1].toString());
+ assertNotNull(e2_s1_i2_depimages[1].getLabelText());
+ assertTrue(e2_s1_i2_depimages[1].hasChildren());
+ assertEquals(e2_s1_images[1], e2_s1_i2_depimages[1].getParent());
+ assertNotNull(e2_s1_i2_depimages[1].getLabelImage());
+
+ assertNotNull(e2_s1_i2_depimages[2].toString());
+ assertNotNull(e2_s1_i2_depimages[2].getLabelText());
+ assertFalse(e2_s1_i2_depimages[2].hasChildren());
+ assertEquals(e2_s1_images[1], e2_s1_i2_depimages[2].getParent());
+ assertNotNull(e2_s1_i2_depimages[2].getLabelImage());
+
+ assertNotNull(e2_s1_i2_depimages[3].toString());
+ assertNotNull(e2_s1_i2_depimages[3].getLabelText());
+ assertTrue(e2_s1_i2_depimages[3].hasChildren());
+ assertEquals(e2_s1_images[1], e2_s1_i2_depimages[3].getParent());
+ assertNotNull(e2_s1_i2_depimages[3].getLabelImage());
+
+ assertNotNull(e2_s2_i1_symbols[0].toString());
+ assertNotNull(e2_s2_i1_symbols[0].getLabelText());
+ assertEquals(TestPlugin.SYMBOL1_FILENAME, ((UiModelSymbol)e2_s2_i1_symbols[0]).getFileName());
+ assertTrue(e2_s2_i1_symbols[0].hasChildren());
+ assertEquals(e2_s2_images[0], e2_s2_i1_symbols[0].getParent());
+ assertNotNull(e2_s2_i1_symbols[0].getLabelImage());
+
+ assertNotNull(e2_s2_i1_symbols[1].toString());
+ assertNotNull(e2_s2_i1_symbols[1].getLabelText());
+ assertEquals(TestPlugin.SYMBOL2_FILENAME, ((UiModelSymbol)e2_s2_i1_symbols[1]).getFileName());
+ assertTrue(e2_s2_i1_symbols[1].hasChildren());
+ assertEquals(e2_s2_images[0], e2_s2_i1_symbols[1].getParent());
+ assertNotNull(e2_s2_i1_symbols[1].getLabelImage());
+
+ /* test the symbols from the dep images */
+ IUiModelElement[] e1_s1_i2_dep1_symbols = e1_s1_i2_depimages[0].getChildren(),
+ e1_s1_i2_dep2_symbols = e1_s1_i2_depimages[1].getChildren(),
+ e1_s1_i2_dep3_symbols = e1_s1_i2_depimages[2].getChildren(),
+ e1_s1_i2_dep4_symbols = e1_s1_i2_depimages[3].getChildren(),
+ e2_s1_i2_dep1_symbols = e2_s1_i2_depimages[0].getChildren(),
+ e2_s1_i2_dep2_symbols = e2_s1_i2_depimages[1].getChildren(),
+ e2_s1_i2_dep3_symbols = e2_s1_i2_depimages[2].getChildren(),
+ e2_s1_i2_dep4_symbols = e2_s1_i2_depimages[3].getChildren();
+
+ assertNull(e1_s1_i2_dep1_symbols);
+ assertNotNull(e1_s1_i2_dep2_symbols);
+ assertNull(e1_s1_i2_dep3_symbols);
+ assertNotNull(e1_s1_i2_dep4_symbols);
+ assertNull(e2_s1_i2_dep1_symbols);
+ assertNotNull(e2_s1_i2_dep2_symbols);
+ assertNull(e2_s1_i2_dep3_symbols);
+ assertNotNull(e2_s1_i2_dep4_symbols);
+ assertEquals(2, e1_s1_i2_dep2_symbols.length);
+ assertEquals(2, e1_s1_i2_dep4_symbols.length);
+ assertEquals(2, e2_s1_i2_dep2_symbols.length);
+ assertEquals(2, e2_s1_i2_dep4_symbols.length);
+ assertNotNull(e1_s1_i2_dep2_symbols[0]);
+ assertNotNull(e1_s1_i2_dep2_symbols[1]);
+ assertNotNull(e1_s1_i2_dep4_symbols[0]);
+ assertNotNull(e1_s1_i2_dep4_symbols[1]);
+ assertNotNull(e2_s1_i2_dep2_symbols[0]);
+ assertNotNull(e2_s1_i2_dep2_symbols[1]);
+ assertNotNull(e2_s1_i2_dep4_symbols[0]);
+ assertNotNull(e2_s1_i2_dep4_symbols[1]);
+
+ assertNotNull(e1_s1_i2_dep2_symbols[0].toString());
+ assertNotNull(e1_s1_i2_dep2_symbols[0].getLabelText());
+ assertEquals(TestPlugin.DEP2_SYMBOL1_FILENAME, ((UiModelSymbol)e1_s1_i2_dep2_symbols[0]).getFileName());
+ assertFalse(e1_s1_i2_dep2_symbols[0].hasChildren());
+ assertEquals(e1_s1_i2_depimages[1], e1_s1_i2_dep2_symbols[0].getParent());
+ assertNotNull(e1_s1_i2_dep2_symbols[0].getLabelImage());
+
+ assertNotNull(e1_s1_i2_dep2_symbols[1].toString());
+ assertNotNull(e1_s1_i2_dep2_symbols[1].getLabelText());
+ assertEquals(TestPlugin.DEP2_SYMBOL2_FILENAME, ((UiModelSymbol)e1_s1_i2_dep2_symbols[1]).getFileName());
+ assertFalse(e1_s1_i2_dep2_symbols[1].hasChildren());
+ assertEquals(e1_s1_i2_depimages[1], e1_s1_i2_dep2_symbols[1].getParent());
+ assertNotNull(e1_s1_i2_dep2_symbols[1].getLabelImage());
+
+ assertNotNull(e1_s1_i2_dep4_symbols[0].toString());
+ assertNotNull(e1_s1_i2_dep4_symbols[0].getLabelText());
+ assertEquals(TestPlugin.DEP4_SYMBOL_FILENAME, ((UiModelSymbol)e1_s1_i2_dep4_symbols[0]).getFileName());
+ assertFalse(e1_s1_i2_dep4_symbols[0].hasChildren());
+ assertEquals(e1_s1_i2_depimages[3], e1_s1_i2_dep4_symbols[0].getParent());
+ assertNotNull(e1_s1_i2_dep4_symbols[0].getLabelImage());
+
+ assertNotNull(e1_s1_i2_dep4_symbols[1].toString());
+ assertNotNull(e1_s1_i2_dep4_symbols[1].getLabelText());
+ assertEquals(TestPlugin.DEP4_SYMBOL_FILENAME, ((UiModelSymbol)e1_s1_i2_dep4_symbols[1]).getFileName());
+ assertFalse(e1_s1_i2_dep4_symbols[1].hasChildren());
+ assertEquals(e1_s1_i2_depimages[3], e1_s1_i2_dep4_symbols[1].getParent());
+ assertNotNull(e1_s1_i2_dep4_symbols[1].getLabelImage());
+
+ assertNotNull(e2_s1_i2_dep2_symbols[0].toString());
+ assertNotNull(e2_s1_i2_dep2_symbols[0].getLabelText());
+ assertEquals(TestPlugin.DEP2_SYMBOL1_FILENAME, ((UiModelSymbol)e2_s1_i2_dep2_symbols[0]).getFileName());
+ assertFalse(e2_s1_i2_dep2_symbols[0].hasChildren());
+ assertEquals(e2_s1_i2_depimages[1], e2_s1_i2_dep2_symbols[0].getParent());
+ assertNotNull(e2_s1_i2_dep2_symbols[0].getLabelImage());
+
+ assertNotNull(e2_s1_i2_dep2_symbols[1].toString());
+ assertNotNull(e2_s1_i2_dep2_symbols[1].getLabelText());
+ assertEquals(TestPlugin.DEP2_SYMBOL2_FILENAME, ((UiModelSymbol)e2_s1_i2_dep2_symbols[1]).getFileName());
+ assertFalse(e2_s1_i2_dep2_symbols[1].hasChildren());
+ assertEquals(e2_s1_i2_depimages[1], e2_s1_i2_dep2_symbols[1].getParent());
+ assertNotNull(e2_s1_i2_dep2_symbols[1].getLabelImage());
+
+ assertNotNull(e2_s1_i2_dep4_symbols[0].toString());
+ assertNotNull(e2_s1_i2_dep4_symbols[0].getLabelText());
+ assertEquals(TestPlugin.DEP4_SYMBOL_FILENAME, ((UiModelSymbol)e2_s1_i2_dep4_symbols[0]).getFileName());
+ assertFalse(e2_s1_i2_dep4_symbols[0].hasChildren());
+ assertEquals(e2_s1_i2_depimages[3], e2_s1_i2_dep4_symbols[0].getParent());
+ assertNotNull(e2_s1_i2_dep4_symbols[0].getLabelImage());
+
+ assertNotNull(e2_s1_i2_dep4_symbols[1].toString());
+ assertNotNull(e2_s1_i2_dep4_symbols[1].getLabelText());
+ assertEquals(TestPlugin.DEP4_SYMBOL_FILENAME, ((UiModelSymbol)e2_s1_i2_dep4_symbols[1]).getFileName());
+ assertFalse(e2_s1_i2_dep4_symbols[1].hasChildren());
+ assertEquals(e2_s1_i2_depimages[3], e2_s1_i2_dep4_symbols[1].getParent());
+ assertNotNull(e2_s1_i2_dep4_symbols[1].getLabelImage());
+
+ /* test UiModelSample */
+ IUiModelElement[] e1_s1_i1_s1_samples = e1_s1_i1_symbols[0].getChildren(),
+ e1_s1_i1_s2_samples = e1_s1_i1_symbols[1].getChildren(),
+ e1_s1_d2_s1_samples = e1_s1_i2_dep2_symbols[0].getChildren(),
+ e1_s1_d2_s2_samples = e1_s1_i2_dep2_symbols[1].getChildren(),
+ e1_s1_d4_s1_samples = e1_s1_i2_dep4_symbols[0].getChildren(),
+ e1_s1_d4_s2_samples = e1_s1_i2_dep4_symbols[1].getChildren(),
+ e2_s1_i1_s1_samples = e2_s1_i1_symbols[0].getChildren(),
+ e2_s1_i1_s2_samples = e2_s1_i1_symbols[1].getChildren(),
+ e2_s1_d2_s1_samples = e2_s1_i2_dep2_symbols[0].getChildren(),
+ e2_s1_d2_s2_samples = e2_s1_i2_dep2_symbols[1].getChildren(),
+ e2_s1_d4_s1_samples = e2_s1_i2_dep4_symbols[0].getChildren(),
+ e2_s1_d4_s2_samples = e2_s1_i2_dep4_symbols[1].getChildren(),
+ e2_s2_i1_s1_samples = e2_s2_i1_symbols[0].getChildren(),
+ e2_s2_i1_s2_samples = e2_s2_i1_symbols[1].getChildren();
+
+ assertNotNull(e1_s1_i1_s1_samples);
+ assertNotNull(e1_s1_i1_s2_samples);
+ assertNotNull(e1_s1_d2_s1_samples);
+ assertNotNull(e1_s1_d2_s2_samples);
+ assertNotNull(e1_s1_d4_s1_samples);
+ assertNotNull(e1_s1_d4_s2_samples);
+ assertNotNull(e2_s1_i1_s1_samples);
+ assertNotNull(e2_s1_i1_s2_samples);
+ assertNotNull(e2_s1_d2_s1_samples);
+ assertNotNull(e2_s1_d2_s2_samples);
+ assertNotNull(e2_s1_d4_s1_samples);
+ assertNotNull(e2_s1_d4_s2_samples);
+ assertNotNull(e2_s2_i1_s1_samples);
+ assertNotNull(e2_s2_i1_s2_samples);
+ assertEquals(4, e1_s1_i1_s1_samples.length);
+ assertEquals(3, e1_s1_i1_s2_samples.length);
+ //0 but not null for dep images due to samples with no line #
+ assertEquals(0, e1_s1_d2_s1_samples.length);
+ assertEquals(0, e1_s1_d2_s2_samples.length);
+ assertEquals(0, e1_s1_d4_s1_samples.length);
+ assertEquals(0, e1_s1_d4_s2_samples.length);
+ assertEquals(4, e2_s1_i1_s1_samples.length);
+ assertEquals(3, e2_s1_i1_s2_samples.length);
+ assertEquals(0, e2_s1_d2_s1_samples.length);
+ assertEquals(0, e2_s1_d2_s2_samples.length);
+ assertEquals(0, e2_s1_d4_s1_samples.length);
+ assertEquals(0, e2_s1_d4_s2_samples.length);
+ assertEquals(4, e2_s2_i1_s1_samples.length);
+ assertEquals(3, e2_s2_i1_s2_samples.length);
+ assertNotNull(e1_s1_i1_s1_samples[0]);
+ assertNotNull(e1_s1_i1_s1_samples[1]);
+ assertNotNull(e1_s1_i1_s1_samples[2]);
+ assertNotNull(e1_s1_i1_s1_samples[3]);
+ assertNotNull(e1_s1_i1_s2_samples[0]);
+ assertNotNull(e1_s1_i1_s2_samples[1]);
+ assertNotNull(e1_s1_i1_s2_samples[2]);
+//
+ assertNotNull(e2_s1_i1_s1_samples[0]);
+ assertNotNull(e2_s1_i1_s1_samples[1]);
+ assertNotNull(e2_s1_i1_s1_samples[2]);
+ assertNotNull(e2_s1_i1_s1_samples[3]);
+ assertNotNull(e2_s1_i1_s2_samples[0]);
+ assertNotNull(e2_s1_i1_s2_samples[1]);
+ assertNotNull(e2_s1_i1_s2_samples[2]);
+ assertNotNull(e2_s2_i1_s1_samples[0]);
+ assertNotNull(e2_s2_i1_s1_samples[1]);
+ assertNotNull(e2_s2_i1_s1_samples[2]);
+ assertNotNull(e2_s2_i1_s1_samples[3]);
+ assertNotNull(e2_s2_i1_s2_samples[0]);
+ assertNotNull(e2_s2_i1_s2_samples[1]);
+ assertNotNull(e2_s2_i1_s2_samples[2]);
+//
+ assertNotNull(e1_s1_i1_s1_samples[0].toString());
+ assertNotNull(e1_s1_i1_s1_samples[0].getLabelText());
+ assertEquals(42, ((UiModelSample)e1_s1_i1_s1_samples[0]).getLine());
+ assertEquals((double)0.6341, ((UiModelSample)e1_s1_i1_s1_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s1_samples[0].getChildren());
+ assertFalse(e1_s1_i1_s1_samples[0].hasChildren());
+ assertEquals(e1_s1_i1_symbols[0], e1_s1_i1_s1_samples[0].getParent());
+ assertNotNull(e1_s1_i1_s1_samples[0].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s1_samples[1].toString());
+ assertNotNull(e1_s1_i1_s1_samples[1].getLabelText());
+ assertEquals(36, ((UiModelSample)e1_s1_i1_s1_samples[1]).getLine());
+ assertEquals((double)0.1951, ((UiModelSample)e1_s1_i1_s1_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s1_samples[1].getChildren());
+ assertFalse(e1_s1_i1_s1_samples[1].hasChildren());
+ assertEquals(e1_s1_i1_symbols[0], e1_s1_i1_s1_samples[1].getParent());
+ assertNotNull(e1_s1_i1_s1_samples[1].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s1_samples[2].toString());
+ assertNotNull(e1_s1_i1_s1_samples[2].getLabelText());
+ assertEquals(31, ((UiModelSample)e1_s1_i1_s1_samples[2]).getLine());
+ assertEquals((double)0.0488, ((UiModelSample)e1_s1_i1_s1_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s1_samples[2].getChildren());
+ assertFalse(e1_s1_i1_s1_samples[2].hasChildren());
+ assertEquals(e1_s1_i1_symbols[0], e1_s1_i1_s1_samples[2].getParent());
+ assertNotNull(e1_s1_i1_s1_samples[2].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s1_samples[3].toString());
+ assertNotNull(e1_s1_i1_s1_samples[3].getLabelText());
+ assertEquals(39, ((UiModelSample)e1_s1_i1_s1_samples[3]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e1_s1_i1_s1_samples[3]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s1_samples[3].getChildren());
+ assertFalse(e1_s1_i1_s1_samples[3].hasChildren());
+ assertEquals(e1_s1_i1_symbols[0], e1_s1_i1_s1_samples[3].getParent());
+ assertNotNull(e1_s1_i1_s1_samples[3].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s2_samples[0].toString());
+ assertNotNull(e1_s1_i1_s2_samples[0].getLabelText());
+ assertEquals(94, ((UiModelSample)e1_s1_i1_s2_samples[0]).getLine());
+ assertEquals((double)0.0976, ((UiModelSample)e1_s1_i1_s2_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s2_samples[0].getChildren());
+ assertFalse(e1_s1_i1_s2_samples[0].hasChildren());
+ assertEquals(e1_s1_i1_symbols[1], e1_s1_i1_s2_samples[0].getParent());
+ assertNotNull(e1_s1_i1_s2_samples[0].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s2_samples[1].toString());
+ assertNotNull(e1_s1_i1_s2_samples[1].getLabelText());
+ assertEquals(12, ((UiModelSample)e1_s1_i1_s2_samples[1]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e1_s1_i1_s2_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s2_samples[1].getChildren());
+ assertFalse(e1_s1_i1_s2_samples[1].hasChildren());
+ assertEquals(e1_s1_i1_symbols[1], e1_s1_i1_s2_samples[1].getParent());
+ assertNotNull(e1_s1_i1_s2_samples[1].getLabelImage());
+
+ assertNotNull(e1_s1_i1_s2_samples[2].toString());
+ assertNotNull(e1_s1_i1_s2_samples[2].getLabelText());
+ assertEquals(55, ((UiModelSample)e1_s1_i1_s2_samples[2]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e1_s1_i1_s2_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e1_s1_i1_s2_samples[2].getChildren());
+ assertFalse(e1_s1_i1_s2_samples[2].hasChildren());
+ assertEquals(e1_s1_i1_symbols[1], e1_s1_i1_s2_samples[2].getParent());
+ assertNotNull(e1_s1_i1_s2_samples[2].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s1_samples[0].toString());
+ assertNotNull(e2_s1_i1_s1_samples[0].getLabelText());
+ assertEquals(42, ((UiModelSample)e2_s1_i1_s1_samples[0]).getLine());
+ assertEquals((double)0.6341, ((UiModelSample)e2_s1_i1_s1_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s1_samples[0].getChildren());
+ assertFalse(e2_s1_i1_s1_samples[0].hasChildren());
+ assertEquals(e2_s1_i1_symbols[0], e2_s1_i1_s1_samples[0].getParent());
+ assertNotNull(e2_s1_i1_s1_samples[0].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s1_samples[1].toString());
+ assertNotNull(e2_s1_i1_s1_samples[1].getLabelText());
+ assertEquals(36, ((UiModelSample)e2_s1_i1_s1_samples[1]).getLine());
+ assertEquals((double)0.1951, ((UiModelSample)e2_s1_i1_s1_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s1_samples[1].getChildren());
+ assertFalse(e2_s1_i1_s1_samples[1].hasChildren());
+ assertEquals(e2_s1_i1_symbols[0], e2_s1_i1_s1_samples[1].getParent());
+ assertNotNull(e2_s1_i1_s1_samples[1].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s1_samples[2].toString());
+ assertNotNull(e2_s1_i1_s1_samples[2].getLabelText());
+ assertEquals(31, ((UiModelSample)e2_s1_i1_s1_samples[2]).getLine());
+ assertEquals((double)0.0488, ((UiModelSample)e2_s1_i1_s1_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s1_samples[2].getChildren());
+ assertFalse(e2_s1_i1_s1_samples[2].hasChildren());
+ assertEquals(e2_s1_i1_symbols[0], e2_s1_i1_s1_samples[2].getParent());
+ assertNotNull(e2_s1_i1_s1_samples[2].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s1_samples[3].toString());
+ assertNotNull(e2_s1_i1_s1_samples[3].getLabelText());
+ assertEquals(39, ((UiModelSample)e2_s1_i1_s1_samples[3]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s1_i1_s1_samples[3]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s1_samples[3].getChildren());
+ assertFalse(e2_s1_i1_s1_samples[3].hasChildren());
+ assertEquals(e2_s1_i1_symbols[0], e2_s1_i1_s1_samples[3].getParent());
+ assertNotNull(e2_s1_i1_s1_samples[3].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s2_samples[0].toString());
+ assertNotNull(e2_s1_i1_s2_samples[0].getLabelText());
+ assertEquals(94, ((UiModelSample)e2_s1_i1_s2_samples[0]).getLine());
+ assertEquals((double)0.0976, ((UiModelSample)e2_s1_i1_s2_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s2_samples[0].getChildren());
+ assertFalse(e2_s1_i1_s2_samples[0].hasChildren());
+ assertEquals(e2_s1_i1_symbols[1], e2_s1_i1_s2_samples[0].getParent());
+ assertNotNull(e2_s1_i1_s2_samples[0].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s2_samples[1].toString());
+ assertNotNull(e2_s1_i1_s2_samples[1].getLabelText());
+ assertEquals(12, ((UiModelSample)e2_s1_i1_s2_samples[1]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s1_i1_s2_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s2_samples[1].getChildren());
+ assertFalse(e2_s1_i1_s2_samples[1].hasChildren());
+ assertEquals(e2_s1_i1_symbols[1], e2_s1_i1_s2_samples[1].getParent());
+ assertNotNull(e2_s1_i1_s2_samples[1].getLabelImage());
+
+ assertNotNull(e2_s1_i1_s2_samples[2].toString());
+ assertNotNull(e2_s1_i1_s2_samples[2].getLabelText());
+ assertEquals(55, ((UiModelSample)e2_s1_i1_s2_samples[2]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s1_i1_s2_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s1_i1_s2_samples[2].getChildren());
+ assertFalse(e2_s1_i1_s2_samples[2].hasChildren());
+ assertEquals(e2_s1_i1_symbols[1], e2_s1_i1_s2_samples[2].getParent());
+ assertNotNull(e2_s1_i1_s2_samples[2].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s1_samples[0].toString());
+ assertNotNull(e2_s2_i1_s1_samples[0].getLabelText());
+ assertEquals(42, ((UiModelSample)e2_s2_i1_s1_samples[0]).getLine());
+ assertEquals((double)0.65, ((UiModelSample)e2_s2_i1_s1_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s1_samples[0].getChildren());
+ assertFalse(e2_s2_i1_s1_samples[0].hasChildren());
+ assertEquals(e2_s2_i1_symbols[0], e2_s2_i1_s1_samples[0].getParent());
+ assertNotNull(e2_s2_i1_s1_samples[0].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s1_samples[1].toString());
+ assertNotNull(e2_s2_i1_s1_samples[1].getLabelText());
+ assertEquals(36, ((UiModelSample)e2_s2_i1_s1_samples[1]).getLine());
+ assertEquals((double)0.2, ((UiModelSample)e2_s2_i1_s1_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s1_samples[1].getChildren());
+ assertFalse(e2_s2_i1_s1_samples[1].hasChildren());
+ assertEquals(e2_s2_i1_symbols[0], e2_s2_i1_s1_samples[1].getParent());
+ assertNotNull(e2_s2_i1_s1_samples[1].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s1_samples[2].toString());
+ assertNotNull(e2_s2_i1_s1_samples[2].getLabelText());
+ assertEquals(31, ((UiModelSample)e2_s2_i1_s1_samples[2]).getLine());
+ assertEquals((double)0.05, ((UiModelSample)e2_s2_i1_s1_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s1_samples[2].getChildren());
+ assertFalse(e2_s2_i1_s1_samples[2].hasChildren());
+ assertEquals(e2_s2_i1_symbols[0], e2_s2_i1_s1_samples[2].getParent());
+ assertNotNull(e2_s2_i1_s1_samples[2].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s1_samples[3].toString());
+ assertNotNull(e2_s2_i1_s1_samples[3].getLabelText());
+ assertEquals(39, ((UiModelSample)e2_s2_i1_s1_samples[3]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s2_i1_s1_samples[3]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s1_samples[3].getChildren());
+ assertFalse(e2_s2_i1_s1_samples[3].hasChildren());
+ assertEquals(e2_s2_i1_symbols[0], e2_s2_i1_s1_samples[3].getParent());
+ assertNotNull(e2_s2_i1_s1_samples[3].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s2_samples[0].toString());
+ assertNotNull(e2_s2_i1_s2_samples[0].getLabelText());
+ assertEquals(94, ((UiModelSample)e2_s2_i1_s2_samples[0]).getLine());
+ assertEquals((double)0.1, ((UiModelSample)e2_s2_i1_s2_samples[0]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s2_samples[0].getChildren());
+ assertFalse(e2_s2_i1_s2_samples[0].hasChildren());
+ assertEquals(e2_s2_i1_symbols[1], e2_s2_i1_s2_samples[0].getParent());
+ assertNotNull(e2_s2_i1_s2_samples[0].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s2_samples[1].toString());
+ assertNotNull(e2_s2_i1_s2_samples[1].getLabelText());
+ assertEquals(12, ((UiModelSample)e2_s2_i1_s2_samples[1]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s2_i1_s2_samples[1]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s2_samples[1].getChildren());
+ assertFalse(e2_s2_i1_s2_samples[1].hasChildren());
+ assertEquals(e2_s2_i1_symbols[1], e2_s2_i1_s2_samples[1].getParent());
+ assertNotNull(e2_s2_i1_s2_samples[1].getLabelImage());
+
+ assertNotNull(e2_s2_i1_s2_samples[2].toString());
+ assertNotNull(e2_s2_i1_s2_samples[2].getLabelText());
+ assertEquals(55, ((UiModelSample)e2_s2_i1_s2_samples[2]).getLine());
+ assertEquals((double)0.0, ((UiModelSample)e2_s2_i1_s2_samples[2]).getCountPercentage(), (double)0.0001);
+ assertNull(e2_s2_i1_s2_samples[2].getChildren());
+ assertFalse(e2_s2_i1_s2_samples[2].hasChildren());
+ assertEquals(e2_s2_i1_symbols[1], e2_s2_i1_s2_samples[2].getParent());
+ assertNotNull(e2_s2_i1_s2_samples[2].getLabelImage());
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/UiTestsPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/UiTestsPlugin.java
new file mode 100644
index 0000000000..281930eb62
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/src/org/eclipse/linuxtools/oprofile/ui/tests/UiTestsPlugin.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.tests;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class UiTestsPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.oprofile.ui.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static UiTestsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UiTestsPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ 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)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UiTestsPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/test.xml b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/test.xml
new file mode 100644
index 0000000000..cc74a8cf36
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui.tests/test.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<project name="testsuite" default="run" basedir=".">
+ <property name="classname" value="org.eclipse.linuxtools.oprofile.ui.tests.AllUiTests" />
+ <property name="plugin-name" value="org.eclipse.linuxtools.oprofile.ui.tests" />
+
+ <property name="library-file" value="${eclipse-home}/dropins/${subProjectName2}/plugins/org.eclipse.test/library.xml" />
+
+ <!-- The property ${eclipse-home} should be passed into this script -->
+ <!-- Set a meaningful default value for when it is not. -->
+ <property name="eclipse-home" value="${basedir}/../.." />
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp />
+ <delete>
+ <fileset dir="${eclipse-home}" includes="org*.xml" />
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="oprofile_ui_suite">
+ <property name="oprofile-ui-folder" value="${eclipse-home}/oprofile_ui_folder" />
+ <delete dir="${oprofile-ui-folder}" quiet="true" />
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${oprofile-ui-folder}" />
+ <property name="plugin-name" value="${plugin-name}" />
+ <property name="classname" value="${classname}" />
+ </ant>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+ <mkdir dir="${results}/consolelogs" />
+ <copy failonerror="false" file="${eclipse-home}/results/${classname}.txt" tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,oprofile_ui_suite,cleanup">
+ <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="includes" value="org*.xml" />
+ <property name="output-file" value="${plugin-name}.xml" />
+ </ant>
+ </target>
+
+ <target name="all" depends="run" description="Dummy target to run all tests">
+ </target>
+
+</project>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/.classpath b/oprofile/org.eclipse.linuxtools.oprofile.ui/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/.classpath
@@ -0,0 +1,7 @@
+<?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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/.project b/oprofile/org.eclipse.linuxtools.oprofile.ui/.project
new file mode 100644
index 0000000000..ed72d2c01b
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.oprofile.ui</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/.settings/org.eclipse.jdt.core.prefs b/oprofile/org.eclipse.linuxtools.oprofile.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..5f0bb8a0f9
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Mon Dec 01 14:59:31 EST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/.svnignore b/oprofile/org.eclipse.linuxtools.oprofile.ui/.svnignore
new file mode 100644
index 0000000000..ba077a4031
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/.svnignore
@@ -0,0 +1 @@
+bin
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/META-INF/MANIFEST.MF b/oprofile/org.eclipse.linuxtools.oprofile.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..cbb5164bef
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.ui;singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Vendor: %bundleProvider
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.0",
+ org.eclipse.ui.editors;bundle-version="3.4.0"
+Bundle-Activator: org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-Localization: plugin
+Export-Package: org.eclipse.linuxtools.oprofile.ui;
+ uses:="org.eclipse.jface.resource,
+ org.eclipse.ui,
+ org.eclipse.linuxtools.oprofile.ui.sample,
+ org.eclipse.linuxtools.oprofile.ui.system,
+ org.eclipse.ui.plugin,
+ org.eclipse.core.resources,
+ org.eclipse.jface.viewers,
+ org.eclipse.swt.graphics,
+ org.osgi.framework,
+ org.eclipse.swt.widgets",
+ org.eclipse.linuxtools.oprofile.ui.model,
+ org.eclipse.linuxtools.oprofile.ui.view
+Import-Package: org.eclipse.cdt.core.model,
+ org.eclipse.core.resources,
+ org.eclipse.jface.text,
+ org.eclipse.jface.text.source,
+ org.eclipse.linuxtools.oprofile.core,
+ org.eclipse.linuxtools.oprofile.core.model,
+ org.eclipse.linuxtools.profiling.ui
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/about.html b/oprofile/org.eclipse.linuxtools.oprofile.ui/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/build.properties b/oprofile/org.eclipse.linuxtools.oprofile.ui/build.properties
new file mode 100644
index 0000000000..3268fa63fa
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/build.properties
@@ -0,0 +1,15 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ about.html
+src.includes = META-INF/,\
+ about.html,\
+ icons/,\
+ plugin.properties,\
+ plugin.xml,\
+ src/
+individualSourceBundles=true
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/annotate.png b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/annotate.png
new file mode 100644
index 0000000000..6cef6c72c3
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/annotate.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dependent.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dependent.gif
new file mode 100644
index 0000000000..122bada5ff
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dependent.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dump.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dump.gif
new file mode 100644
index 0000000000..d5b800141e
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/dump.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/error.png b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/error.png
new file mode 100644
index 0000000000..7d94eb1176
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/error.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/event.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/event.gif
new file mode 100644
index 0000000000..c91f254ab1
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/event.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/image.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/image.gif
new file mode 100644
index 0000000000..8aa0162df0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/image.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/oprofile_view.png b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/oprofile_view.png
new file mode 100644
index 0000000000..4f8488f1c0
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/oprofile_view.png
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/sample.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/sample.gif
new file mode 100644
index 0000000000..061161ae1c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/sample.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/session.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/session.gif
new file mode 100644
index 0000000000..c2b41bda92
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/session.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/symbol.gif b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/symbol.gif
new file mode 100644
index 0000000000..6ae4604cdb
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/icons/symbol.gif
Binary files differ
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.properties b/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.properties
new file mode 100644
index 0000000000..7049c37f02
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.properties
@@ -0,0 +1,28 @@
+#*******************************************************************************
+# Copyright (c) 2004, 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
+#*******************************************************************************
+bundleName=OProfile UI Plug-in (Incubation)
+bundleProvider=Eclipse Linux Tools
+
+view.groupname=C/C++ Profiling
+view.name=OProfile
+
+view.annotate.toggle.label=Toggle Annotation
+view.annotate.toggle.tooltip=Toggle Annotation
+
+annotateCommand.name=Annotate
+lt.min.pct.label=OProfile Annotation: <0.01%
+lt.05.pct.label=OProfile Annotation: 0.01% - 4.99%
+lt.10.pct.label=OProfile Annotation: 05% - 9.99%
+lt.20.pct.label=OProfile Annotation: 10% - 19.99%
+lt.30.pct.label=OProfile Annotation: 20% - 29.99%
+lt.40.pct.label=OProfile Annotation: 30% - 39.99%
+lt.50.pct.label=OProfile Annotation: 40% - 49.99%
+gt.50.pct.label=OProfile Annotation: >50%
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.xml b/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.xml
new file mode 100644
index 0000000000..338b167d06
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.linuxtools.oprofile.ui.viewgroup"
+ class="org.eclipse.linuxtools.oprofile.ui.view.OprofileView"
+ icon="icons/oprofile_view.png"
+ id="org.eclipse.linuxtools.oprofile.ui.OProfileView"
+ name="%view.name"
+ restorable="true">
+ </view>
+ <category
+ id="org.eclipse.linuxtools.oprofile.ui.viewgroup"
+ name="%view.groupname">
+ </category>
+ </extension>
+</plugin>
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiMessages.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiMessages.java
new file mode 100644
index 0000000000..dc195d4f05
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiMessages.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2004 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class OprofileUiMessages
+{
+
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.oprofile.ui.oprofileui"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private OprofileUiMessages()
+ {
+ }
+
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java
new file mode 100644
index 0000000000..addd19eea3
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/OprofileUiPlugin.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008, 2009 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:
+ * Keith Seitz <keiths@redhat.com> - initial API and implementation
+ * Kent Sebastian <ksebasti@redhat.com> -
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.oprofile.ui;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.linuxtools.oprofile.ui.view.OprofileView;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class OprofileUiPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static OprofileUiPlugin plugin;
+
+ private OprofileView _oprofileview = null;
+
+ public static final String ID_PLUGIN = "org.eclipse.linuxtools.oprofile.ui"; //$NON-NLS-1$
+ public static final String ID_OPROFILE_VIEW = ID_PLUGIN + ".OProfileView"; //$NON-NLS-1$
+
+ private static final String ICON_PATH = "icons/"; //$NON-NLS-1$
+ public static final String SESSION_ICON = ICON_PATH + "session.gif"; //$NON-NLS-1$
+ public static final String EVENT_ICON = ICON_PATH + "event.gif"; //$NON-NLS-1$
+ public static final String IMAGE_ICON = ICON_PATH + "image.gif"; //$NON-NLS-1$
+ public static final String DEPENDENT_ICON = ICON_PATH + "dependent.gif"; //$NON-NLS-1$
+ public static final String SYMBOL_ICON = ICON_PATH + "symbol.gif"; //$NON-NLS-1$
+ public static final String SAMPLE_ICON = ICON_PATH + "sample.gif"; //$NON-NLS-1$
+ public static final String ERROR_ICON = ICON_PATH + "error.png"; //$NON-NLS-1$
+
+ public static final double MINIMUM_SAMPLE_PERCENTAGE = 0.0001;
+
+ public static final String ANNOTATION_TYPE_LT_MIN_PERCENTAGE = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.min.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_05 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.05.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_10 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.10.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_20 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.20.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_30 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.30.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_40 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.40.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_LT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.lt.50.pct"; //$NON-NLS-1$
+ public static final String ANNOTATION_TYPE_GT_50 = "org.eclipse.linuxtools.oprofile.ui.annotation.gt.50.pct"; //$NON-NLS-1$
+
+ /**
+ * The constructor.
+ */
+ public OprofileUiPlugin() {
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+
+ /**
+ * Returns the shared instance.
+ */
+ public static OprofileUiPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * 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(ID_PLUGIN, path);
+ }
+
+
+ public OprofileView getOprofileView() {
+ return _oprofileview;
+ }
+
+ public void setOprofileView(OprofileView _oprofileview) {
+ this._oprofileview = _oprofileview;
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ public static Shell getActiveWorkbenchShell() {
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
+ if (window != null) {
+ return window.getShell();
+ }
+ return null;
+ }
+
+ public static String getPercentageString(double percentage) {
+ NumberFormat nf = NumberFormat.getPercentInstance();
+ if (nf instanceof DecimalFormat) {
+ nf.setMinimumFractionDigits(2);
+ nf.setMaximumFractionDigits(2);
+ }
+
+ if (percentage < OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE) {
+ return "<" + nf.format(OprofileUiPlugin.MINIMUM_SAMPLE_PERCENTAGE); //$NON-NLS-1$
+ } else {
+ return nf.format(percentage);
+ }
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/IUiModelElement.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/IUiModelElement.java
new file mode 100644
index 0000000000..e8a37b1b1c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/IUiModelElement.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Interface for all model elements to ease use with the tree viewer.
+ */
+public interface IUiModelElement {
+ /**
+ * Returns the text to display in the tree viewer as required by the label provider.
+ * @return text describing this element
+ */
+ String getLabelText();
+
+ /**
+ * Returns the children of this element.
+ * @return an array of IUiModelElements
+ */
+ IUiModelElement[] getChildren();
+
+ /**
+ * Returns if this element has any children. Unless there is no data in
+ * a session, only samples should not have any children.
+ * @return true if children, false if no children
+ */
+ boolean hasChildren();
+
+ /**
+ * Returns the parent element.
+ * @return the parent element
+ */
+ IUiModelElement getParent();
+
+ /**
+ * Returns the Image to display next to the text in the tree viewer.
+ * @return an Image object of the icon
+ */
+ Image getLabelImage();
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelDependent.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelDependent.java
new file mode 100644
index 0000000000..6b7a32b137
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelDependent.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+public class UiModelDependent implements IUiModelElement {
+ private IUiModelElement _parent;
+ private OpModelImage _dataModelDependents[];
+ private UiModelImage _dependents[];
+ private int _totalCount;
+ private int _depCount;
+
+ public UiModelDependent(IUiModelElement parent, OpModelImage dependents[], int totalCount, int depCount) {
+ _parent = parent;
+ _dataModelDependents = dependents;
+ _dependents = null;
+ _totalCount = totalCount;
+ _depCount = depCount;
+ refreshModel();
+ }
+
+ private void refreshModel() {
+ _dependents = new UiModelImage[_dataModelDependents.length];
+
+ for (int i = 0; i < _dataModelDependents.length; i++) {
+ _dependents[i] = new UiModelImage(this, _dataModelDependents[i], _totalCount, 0);
+ }
+ }
+
+ @Override
+ public String toString() {
+ double countPercentage = (double)_depCount / (double)_totalCount;
+ String percentage = OprofileUiPlugin.getPercentageString(countPercentage);
+
+ return percentage + " " + OprofileUiMessages.getString("uimodel.percentage.in") + OprofileUiMessages.getString("uimodel.dependent.dependent.images"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ return _dependents;
+ }
+
+ public boolean hasChildren() {
+ return true; //must have children, or this object wouldn't be created
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.DEPENDENT_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelError.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelError.java
new file mode 100644
index 0000000000..0efcf5b443
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelError.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+public class UiModelError implements IUiModelElement {
+ public static final UiModelError NO_SAMPLES_ERROR = new UiModelError(OprofileUiMessages.getString("root.error.nosamples")); //$NON-NLS-1$
+
+ private String errorMessage;
+
+ public UiModelError(String message) {
+ errorMessage = message;
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return errorMessage;
+ }
+
+ public IUiModelElement[] getChildren() {
+ return null;
+ }
+
+ public boolean hasChildren() {
+ return false;
+ }
+
+ public IUiModelElement getParent() {
+ return null;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.ERROR_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelEvent.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelEvent.java
new file mode 100644
index 0000000000..9586542015
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelEvent.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Top level elements displayed in the view -- events that oprofile
+ * has profiled. Must have children sessions.
+ */
+public class UiModelEvent implements IUiModelElement {
+ private IUiModelElement _parent = null; //parent node -- necessary?
+ private OpModelEvent _event; //the node in the data model
+ private UiModelSession _sessions[]; //this node's children
+
+ public UiModelEvent(OpModelEvent event) {
+ if (event != null) {
+ _event = event;
+ refreshModel();
+ }
+ }
+
+ /**
+ * Create the ui sessions from the data model.
+ */
+ private void refreshModel() {
+ OpModelSession dataModelSessions[] = _event.getSessions();
+ _sessions = new UiModelSession[dataModelSessions.length];
+
+ for (int i = 0; i < dataModelSessions.length; i++) {
+ _sessions[i] = new UiModelSession(this, dataModelSessions[i]);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return (_event == null ? "" : _event.getName()); //$NON-NLS-1$
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ return _sessions;
+ }
+
+ public boolean hasChildren() {
+ return (_sessions == null || _sessions.length == 0 ? false : true);
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.EVENT_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelImage.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelImage.java
new file mode 100644
index 0000000000..e412909545
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelImage.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSymbol;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Children of sessions in the view -- the binary which was profiled.
+ * May or may not have child symbols. Note that although the dependent
+ * images are children of OpModelImages in the data model, for usability's
+ * sake they are children of the parent session in the tree.
+ */
+public class UiModelImage implements IUiModelElement {
+ private IUiModelElement _parent; //parent element, may be UiModelSession or UiModelDependent
+ private OpModelImage _image; //the node in the data model
+ private UiModelSymbol _symbols[]; //this node's child (symbols)
+ private int _totalCount; //total number of samples
+ private int _depCount; //number of samples from dependent images
+
+ public UiModelImage(IUiModelElement parent, OpModelImage image, int totalCount, int depCount) {
+ _parent = parent;
+ _image = image;
+ _symbols = null;
+ _totalCount = totalCount;
+ _depCount = depCount;
+ refreshModel();
+ }
+
+ private void refreshModel() {
+ OpModelSymbol[] dataModelSymbols = _image.getSymbols();
+
+ //dependent images may not have symbols
+ if (dataModelSymbols != null) {
+ _symbols = new UiModelSymbol[dataModelSymbols.length];
+
+ for (int i = 0; i < dataModelSymbols.length; i++) {
+ _symbols[i] = new UiModelSymbol(this, dataModelSymbols[i], _totalCount);
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ if (_image.getCount() == OpModelImage.IMAGE_PARSE_ERROR) {
+ return OprofileUiMessages.getString("opxmlParse.error.multipleImages"); //$NON-NLS-1$
+ } else {
+ double countPercentage = (double)(_image.getCount() - _depCount) / (double)_totalCount;
+ String percentage = OprofileUiPlugin.getPercentageString(countPercentage);
+
+ return percentage + " " + OprofileUiMessages.getString("uimodel.percentage.in") + _image.getName(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ IUiModelElement children[] = null;
+
+ if (_symbols != null) {
+ children = new IUiModelElement[_symbols.length];
+
+ for (int i = 0; i < _symbols.length; i++) {
+ children[i] = _symbols[i];
+ }
+ }
+
+ return children;
+ }
+
+ public boolean hasChildren() {
+ return (_symbols == null || _symbols.length == 0 ? false : true);
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.IMAGE_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelRoot.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelRoot.java
new file mode 100644
index 0000000000..3a86314725
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelRoot.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008,2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Convenience class for creating the UI model from the oprofile data model,
+ * via a single point of access.
+ */
+public class UiModelRoot implements IUiModelElement {
+ private static UiModelRoot _uiModelRoot = new UiModelRoot(); //singleton
+ private UiModelEvent[] _events; //this node's children
+ private UiModelError _rootError;
+
+ /** constructor, private for singleton use **/
+ protected UiModelRoot() {
+// refreshModel();
+ _events = null;
+ _rootError = null;
+// _uiModelRoot = this;
+ }
+
+ /**
+ * Get the instance of this ui model root.
+ * @return the ui model root object
+ */
+ public static UiModelRoot getDefault() {
+ return _uiModelRoot;
+ }
+
+ /**
+ * Kick off creating the UI model from the data model. Meant to
+ * be called from UI code. The refreshModel() method is called for
+ * the child elements from their constructor.
+ */
+ public void refreshModel() {
+ OpModelEvent dataModelEvents[] = getModelDataEvents();
+
+ _rootError = null;
+ _events = null;
+
+ if (dataModelEvents == null || dataModelEvents.length == 0) {
+ _rootError = UiModelError.NO_SAMPLES_ERROR;
+ } else {
+ _events = new UiModelEvent[dataModelEvents.length];
+ for (int i = 0; i < dataModelEvents.length; i++) {
+ _events[i] = new UiModelEvent(dataModelEvents[i]);
+ }
+ }
+ }
+
+ protected OpModelEvent[] getModelDataEvents() {
+ OpModelRoot modelRoot = OpModelRoot.getDefault();
+ return modelRoot.getEvents();
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return null;
+ }
+
+ public IUiModelElement[] getChildren() {
+ if (_events != null)
+ return _events;
+ else
+ return new IUiModelElement[] { _rootError };
+ }
+
+ public boolean hasChildren() {
+ return true;
+ }
+
+ public IUiModelElement getParent() {
+ return null;
+ }
+
+ public Image getLabelImage() {
+ return null;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSample.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSample.java
new file mode 100644
index 0000000000..389ab2f7d4
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSample.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSample;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+public class UiModelSample implements IUiModelElement {
+ private IUiModelElement _parent; //parent element
+ private OpModelSample _sample; //the node in the data model
+ private int _totalCount; //total sample count for the parent session
+
+ public UiModelSample(IUiModelElement parent, OpModelSample sample, int totalCount) {
+ _parent = parent;
+ _sample = sample;
+ _totalCount = totalCount;
+ }
+
+ @Override
+ public String toString() {
+ double countPercentage = (double)_sample.getCount() / (double)_totalCount;
+ String percentage = OprofileUiPlugin.getPercentageString(countPercentage);
+
+ return percentage + " " + OprofileUiMessages.getString("uimodel.sample.on.line") + Integer.toString(_sample.getLine()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public int getLine() {
+ return _sample.getLine();
+ }
+
+ public double getCountPercentage() {
+ return (double)_sample.getCount() / (double)_totalCount;
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ return null;
+ }
+
+ public boolean hasChildren() {
+ return false; //bottom level element
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.SAMPLE_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSession.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSession.java
new file mode 100644
index 0000000000..10d3374b27
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSession.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelImage;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Children of events in the view -- sessions containing images/symbols
+ * for its parent event. Must have a child image. May also have dependent
+ * images, which are children of the Image in the data model, but are
+ * displayed as children of the session in the view.
+ */
+public class UiModelSession implements IUiModelElement {
+ private IUiModelElement _parent; //parent element
+ private OpModelSession _session; //the node in the data model
+ private UiModelImage _image; //this node's child
+ private UiModelDependent _dependent; //dependent images of the OpModelImage
+
+ //OProfile's default session name
+ private static final String DEFAULT_SESSION_NAME = "current"; //$NON-NLS-1$
+
+ public UiModelSession(IUiModelElement parent, OpModelSession session) {
+ _parent = parent;
+ _session = session;
+ _image = null;
+ _dependent = null;
+ refreshModel();
+ }
+
+ private void refreshModel() {
+ OpModelImage dataModelImage = _session.getImage();
+ if (dataModelImage != null) {
+ _image = new UiModelImage(this, dataModelImage, dataModelImage.getCount(), dataModelImage.getDepCount());
+
+ if (dataModelImage.hasDependents()) {
+ _dependent = new UiModelDependent(this, dataModelImage.getDependents(), dataModelImage.getCount(), dataModelImage.getDepCount());
+ }
+ }
+ }
+
+ @Override
+ public String toString() {
+ return _session.getName();
+ }
+
+ public boolean isDefaultSession() {
+ return _session.getName().equalsIgnoreCase(DEFAULT_SESSION_NAME);
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ if (_session.getName().equals(DEFAULT_SESSION_NAME)){
+ return OprofileUiMessages.getString("UiModelSession_current"); //$NON-NLS-1$
+ }
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ if (_dependent != null) {
+ return new IUiModelElement[] {_image, _dependent};
+ } else {
+ return new IUiModelElement[] {_image};
+ }
+ }
+
+ public boolean hasChildren() {
+ return (_image != null);
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.SESSION_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSymbol.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSymbol.java
new file mode 100644
index 0000000000..a4dae3bfbe
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/model/UiModelSymbol.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.model;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSample;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelSymbol;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Children of images in the view -- a function name in the profiled
+ * image's source code. May or may not have child samples.
+ */
+public class UiModelSymbol implements IUiModelElement {
+ private IUiModelElement _parent; //parent element
+ private OpModelSymbol _symbol; //the node in the data model
+ private UiModelSample _samples[]; //this node's children
+ private int _totalCount; //total count of samples for the parent session
+
+ public UiModelSymbol(IUiModelElement parent, OpModelSymbol symbol, int totalCount) {
+ _parent = parent;
+ _symbol = symbol;
+ _samples = null;
+ _totalCount = totalCount;
+ refreshModel();
+ }
+
+ private void refreshModel() {
+ ArrayList<UiModelSample> sampleList = new ArrayList<UiModelSample>();
+ OpModelSample dataModelSamples []= _symbol.getSamples();
+
+ for (int i = 0; i < dataModelSamples.length; i++) {
+ //dont display samples with line number of 0, meaning no line number
+ // was correlated, more likely that no source file exists
+ if (dataModelSamples[i].getLine() != 0) {
+ sampleList.add(new UiModelSample(this, dataModelSamples[i], _totalCount));
+ }
+ }
+
+ _samples = new UiModelSample[sampleList.size()];
+ sampleList.toArray(_samples);
+ }
+
+ @Override
+ public String toString() {
+ double countPercentage = (double)_symbol.getCount() / (double)_totalCount;
+ String percentage = OprofileUiPlugin.getPercentageString(countPercentage);
+
+ //a hack to get `basename` type functionality
+ String fileName = (new File(_symbol.getFile())).getName();
+// String fileName = _symbol.getFile();
+
+ return percentage + " " + OprofileUiMessages.getString("uimodel.percentage.in") + _symbol.getName() + (fileName.length() == 0 ? "" : " [" + fileName + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ }
+
+ public String getFileName() {
+ return _symbol.getFile();
+ }
+
+ public String getFunctionName(){
+ return _symbol.getName();
+ }
+
+ /** IUiModelElement functions **/
+ public String getLabelText() {
+ return toString();
+ }
+
+ public IUiModelElement[] getChildren() {
+ return _samples;
+ }
+
+ public boolean hasChildren() {
+ return (_samples == null || _samples.length == 0 ? false : true);
+ }
+
+ public IUiModelElement getParent() {
+ return _parent;
+ }
+
+ public Image getLabelImage() {
+ return OprofileUiPlugin.getImageDescriptor(OprofileUiPlugin.SYMBOL_ICON).createImage();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/oprofileui.properties b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/oprofileui.properties
new file mode 100644
index 0000000000..db07240782
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/oprofileui.properties
@@ -0,0 +1,41 @@
+######################################################################
+# Copyright (c) 2004,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:
+# Keith Seitz <keiths@redhat.com> - initial implementation
+# Kent Sebastian <ksebasti@redhat.com>
+######################################################################
+savedialog.title=Save Session
+savedialog.message=Enter the new name of the default session
+savedialog.initial=
+savedialog.validator.invalidChar={0} is an invalid character in session name \"{1}\".
+savedialog.validator.containsWhitespace=Session name \"{0}\" cannot contain whitespace.
+savedialog.validator.exists=Session \"{0}\" already exists.
+
+defaultsessiondialog.nodefaultsession.title=Error Saving Default Session
+defaultsessiondialog.nodefaultsession.message=No default session exists.
+
+view.dialog.parsing.text=Parsing OProfile Data
+view.actions.refresh.label=Refresh View
+view.actions.logreader.label=Open OProfile Daemon Log
+view.actions.savedefaultsession.label=Save Default Session
+
+oprofiled.logreader.dialog.title=OProfiled Log
+oprofiled.logreader.error.fileNotFound=Log file empty or does not exist.
+oprofiled.logreader.error.io=Error reading log file.
+
+uimodel.percentage.in=in
+uimodel.sample.on.line=on line
+uimodel.dependent.dependent.images=dependent images
+UiModelSession_current=current
+
+opxmlParse.error.multipleImages=Error: samples not created from Eclipse-OProfile plugin. Please remove this session.
+
+annotation.text.from=from event
+annotation.text.in=in session
+
+root.error.nosamples=No profiling data is on the system.
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileView.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileView.java
new file mode 100644
index 0000000000..4ecf12d985
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileView.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelRoot;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * The view for the OProfile plugin. Shows the elements gathered by the data model
+ * in a tree viewer, parsed by the ui model (in the model package). The hierarchy
+ * (as it is displayed) looks like:
+ *
+ * UiModelRoot (not shown in the view)
+ * \_ UiModelEvent
+ * \_ ...
+ * \_ UiModelEvent
+ * \_ UiModelSession
+ * \_ ...
+ * \_ UiModelSession
+ * \_ UiModelImage
+ * | \_ UiModelSymbol
+ * | \_ ...
+ * | \_ UiModelSymbol
+ * | \_ UiModelSample
+ * | \_ ...
+ * | \_ UiModelSample
+ * \_ UiModelDependent
+ * \_ UiModelImage
+ * | \_ ... (see above)
+ * \_ ...
+ *
+ * The refreshView() function takes care of launching the data model parsing and
+ * ui model parsing in a separate thread.
+ */
+public class OprofileView extends ViewPart {
+ private TreeViewer _viewer;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ _createTreeViewer(parent);
+ _createActionMenu();
+
+ OprofileUiPlugin.getDefault().setOprofileView(this);
+ }
+
+ private void _createTreeViewer(Composite parent) {
+ _viewer = new TreeViewer(parent, SWT.SINGLE);
+ _viewer.setContentProvider(new OprofileViewContentProvider());
+ _viewer.setLabelProvider(new OprofileViewLabelProvider());
+ _viewer.addDoubleClickListener(new OprofileViewDoubleClickListener());
+ }
+
+ private void _createActionMenu() {
+ IMenuManager manager = getViewSite().getActionBars().getMenuManager();
+
+ manager.add(new OprofileViewLogReaderAction());
+ manager.add(new OprofileViewRefreshAction());
+ manager.add(new OprofileViewSaveDefaultSessionAction());
+ }
+
+ private TreeViewer getTreeViewer() {
+ return _viewer;
+ }
+
+ /**
+ * Extremely convoluted way of getting the running and parsing to happen in
+ * a separate thread, with a progress monitor. In most cases and on fast
+ * machines this will probably only be a blip.
+ */
+ public void refreshView() {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(OprofileUiPlugin.ID_OPROFILE_VIEW);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+
+ IRunnableWithProgress refreshRunner = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ monitor.beginTask(OprofileUiMessages.getString("view.dialog.parsing.text"), 2); //$NON-NLS-1$
+
+ OpModelRoot dataModelRoot = OpModelRoot.getDefault();
+ dataModelRoot.refreshModel();
+// System.out.println(dataModelRoot); //debugging
+ monitor.worked(1);
+
+ final UiModelRoot UiRoot = UiModelRoot.getDefault();
+ UiRoot.refreshModel();
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ OprofileUiPlugin.getDefault().getOprofileView().getTreeViewer().setInput(UiRoot);
+ }
+ });
+ monitor.worked(1);
+
+ monitor.done();
+ }
+ };
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
+ try {
+ dialog.run(true, false, refreshRunner);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewContentProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewContentProvider.java
new file mode 100644
index 0000000000..61ad3220f4
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewContentProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation,
+ * adapted from Keith Seitz's ProfileContentProvider
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
+
+/**
+ * Content provider for the OprofileView's tree viewer.
+ */
+public class OprofileViewContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object element) {
+ Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewContentProvider"); //$NON-NLS-1$
+ return ((IUiModelElement) element).getChildren();
+ }
+
+ public Object getParent(Object element) {
+ Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewContentProvider"); //$NON-NLS-1$
+ return ((IUiModelElement) element).getParent();
+ }
+
+ public boolean hasChildren(Object element) {
+ Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewContentProvider"); //$NON-NLS-1$
+ return ((IUiModelElement) element).hasChildren();
+ }
+
+ public Object[] getElements(Object parentElement) {
+ return getChildren(parentElement);
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java
new file mode 100644
index 0000000000..27eb76a843
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewDoubleClickListener.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import java.util.HashMap;
+
+import org.eclipse.cdt.core.model.ICProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelEvent;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelImage;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSample;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSession;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSymbol;
+import org.eclipse.linuxtools.profiling.ui.ProfileUIUtils;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * Listener for the oprofile view when a user double clicks on an element in the tree.
+ *
+ * Different things occur based on the event:
+ *
+ * UiModelEvent - nothing (?)
+ * UiModelSession - save the session to a different name
+ * UiModelImage - nothing (?)
+ * UiModelSymbol - nothing (?)
+ * UiModelSample - go to line number in appropriate file
+ */
+public class OprofileViewDoubleClickListener implements IDoubleClickListener {
+ public void doubleClick(DoubleClickEvent event) {
+ TreeViewer tv = (TreeViewer) event.getSource();
+ TreeSelection tsl = (TreeSelection) tv.getSelection();
+ IUiModelElement element = (IUiModelElement) tsl.getFirstElement();
+ ICProject project;
+
+ try {
+ if (element instanceof UiModelEvent) {
+ // UiModelEvent event = (UiModelEvent)element;
+
+ } else if (element instanceof UiModelSession) {
+ /* moved into an action menu */
+ } else if (element instanceof UiModelImage) {
+ // UiModelImage image = (UiModelImage)element;
+
+ } else if (element instanceof UiModelSymbol) {
+ final UiModelSymbol symbol = (UiModelSymbol) element;
+ final String imageLabel = symbol.getParent().getLabelText();
+ final String fileName = symbol.getFileName();
+ String functionName = symbol.getFunctionName();
+ int numOfArgs = -1;
+ HashMap<String, int[]> map;
+
+ // hard coded to match "XY.PQ% in /some/arbitrary/path/to/binary"
+ String absPath = imageLabel.substring(imageLabel.indexOf(" in ") + 4);
+ project = ProfileUIUtils.findCProjectWithAbsolutePath(absPath);
+ if (project == null) {
+ return;
+ }
+
+ // detect function with arguments and narrow search accordingly
+ if (functionName.matches(".*\\(.*\\)")) {
+ int start = functionName.indexOf('(');
+ if (functionName.contains(",")) {
+ int end = functionName.indexOf(')');
+ numOfArgs = functionName.substring(start, end).split(",").length;
+ } else {
+ numOfArgs = 1;
+ }
+ functionName = functionName.substring(0, start);
+ }else{
+ numOfArgs = 0;
+ }
+
+ if (fileName.length() > 0 && functionName.length() > 0) {
+ // this should almost ALWAYS be the case
+ // try and go to the function in the file
+ map = ProfileUIUtils.findFunctionsInProject(project,functionName, numOfArgs, fileName, true);
+
+ // if function still can't be found, go to first line in the file
+ if (map.isEmpty()) {
+ ProfileUIUtils.openEditorAndSelect(fileName, 1);
+ } else {
+ for (String loc : map.keySet()) {
+ ProfileUIUtils.openEditorAndSelect(loc, map.get(loc)[0], map.get(loc)[1]);
+ }
+ }
+
+ } else if (functionName.length() > 0) {
+ // can this ever happen ?
+ // try to find the file name that has this function
+ map = ProfileUIUtils.findFunctionsInProject(project, functionName, numOfArgs, null, true);
+
+ for (String loc : map.keySet()) {
+ ProfileUIUtils.openEditorAndSelect(loc, map.get(loc)[0], map.get(loc)[1]);
+ }
+ } else if (fileName.length() > 0) {
+ // can this ever happen ?
+ // jump to 1st line in the file
+ ProfileUIUtils.openEditorAndSelect(fileName, 1);
+ }
+
+ } else if (element instanceof UiModelSample) {
+ // jump to line number in the appropriate file
+ UiModelSample sample = (UiModelSample) element;
+ int line = sample.getLine();
+
+ // get file name from the parent sample
+ final UiModelSymbol symbol = ((UiModelSymbol) sample.getParent());
+ final String fileName = symbol.getFileName();
+ ProfileUIUtils.openEditorAndSelect(fileName, line);
+ }
+ } catch (BadLocationException e1) {
+ e1.printStackTrace();
+ } catch (PartInitException e2) {
+ e2.printStackTrace();
+ } catch (CoreException e3) {
+ e3.printStackTrace();
+ }
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLabelProvider.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLabelProvider.java
new file mode 100644
index 0000000000..2cb4f9ae72
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLabelProvider.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation,
+ * adapted from Keith Seitz's ProfileLabelProvider
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Content provider for OprofileView's tree viewer.
+ */
+public class OprofileViewLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object element) {
+ Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewLabelProvider"); //$NON-NLS-1$
+ return ((IUiModelElement) element).getLabelImage();
+ }
+
+ public String getText(Object element) {
+ Assert.isLegal(element instanceof IUiModelElement, "in OprofileViewLabelProvider"); //$NON-NLS-1$
+ return ((IUiModelElement) element).getLabelText();
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLogReaderAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLogReaderAction.java
new file mode 100644
index 0000000000..07ec62ef83
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewLogReaderAction.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2004,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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ * Keith Seitz <keiths@redhat.com> - much of the code in the LogReader class
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Log reader action. Reads /var/lib/oprofile/samples/oprofiled.log and displays
+ * it in a nice dialog. Although the log is of dubious utility, it might be useful
+ * to some.
+ */
+public class OprofileViewLogReaderAction extends Action {
+ public OprofileViewLogReaderAction() {
+ super(OprofileUiMessages.getString("view.actions.logreader.label")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ LogReader log = new LogReader();
+
+ try {
+ new ProgressMonitorDialog(activeShell).run(true, false, log);
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ //open custom log dialog
+ OprofiledLogDialog odlg = new OprofiledLogDialog(activeShell, log.getLogContents());
+ odlg.open();
+ }
+}
+
+/**
+ * A Runnable to read oprofiled's logfile
+ */
+class LogReader implements Runnable, IRunnableWithProgress {
+ private static long _lastModified = -1;
+ private static String _contents = null;
+
+ public void run() {
+ File logFile = new File(Oprofile.getLogFile());
+ long modified = logFile.lastModified();
+
+ //only reread it if it has been modified since the last run
+ if (modified != _lastModified) {
+ _lastModified = modified;
+ _contents = new String();
+
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader(logFile));
+ String line;
+ while ((line = reader.readLine()) != null) {
+ _contents += line + "\n"; //$NON-NLS-1$
+ }
+ } catch (FileNotFoundException e) {
+ // The file doesn't exist or was erased. Try again next time.
+ _contents = OprofileUiMessages.getString("oprofiled.logreader.error.fileNotFound"); //$NON-NLS-1$
+ } catch (IOException e) {
+ // Error reading log. Try again next time.
+ _lastModified = 0;
+ _contents = OprofileUiMessages.getString("oprofiled.logreader.error.io"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public String getLogContents() {
+ return _contents;
+ }
+
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ this.run();
+ }
+}
+
+/**
+ * A custom dialog box to display the oprofiled log file.
+ */
+class OprofiledLogDialog extends MessageDialog {
+ //string to contain the log file
+ String textContent = null;
+
+ final int GRID_WIDTH = 350;
+ final int GRID_HEIGHT = 400;
+
+ public OprofiledLogDialog (Shell parentShell, String dialogMessage) {
+ super(parentShell, OprofileUiMessages.getString("oprofiled.logreader.dialog.title"), null, null, MessageDialog.NONE, new String[] { IDialogConstants.OK_LABEL }, 0); //$NON-NLS-1$
+ textContent = dialogMessage;
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+ Composite area = new Composite(parent, 0);
+ Layout layout = new GridLayout(1, true);
+ GridData gd = new GridData(GRID_WIDTH, GRID_HEIGHT);
+
+ area.setLayout(layout);
+ area.setLayoutData(gd);
+
+ Text txt = new Text(area, SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
+ txt.setText(textContent);
+ txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ return area;
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewRefreshAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewRefreshAction.java
new file mode 100644
index 0000000000..5f554cd44c
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewRefreshAction.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+
+/**
+ * Refresh menu item.
+ */
+public class OprofileViewRefreshAction extends Action {
+ public OprofileViewRefreshAction() {
+ super(OprofileUiMessages.getString("view.actions.refresh.label")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ OprofileUiPlugin.getDefault().getOprofileView().refreshView();
+ }
+}
diff --git a/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java
new file mode 100644
index 0000000000..183c23d010
--- /dev/null
+++ b/oprofile/org.eclipse.linuxtools.oprofile.ui/src/org/eclipse/linuxtools/oprofile/ui/view/OprofileViewSaveDefaultSessionAction.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 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:
+ * Kent Sebastian <ksebasti@redhat.com> - initial API and implementation
+ * Keith Seitz <keiths@redhat.com> - SaveSessionValidator code
+ *******************************************************************************/
+package org.eclipse.linuxtools.oprofile.ui.view;
+
+import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiMessages;
+import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
+import org.eclipse.linuxtools.oprofile.ui.model.IUiModelElement;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelError;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelRoot;
+import org.eclipse.linuxtools.oprofile.ui.model.UiModelSession;
+
+/**
+ * Menu item to save the default session. Moved from a double-click in the view
+ * on the default session for consistency (since non-default sessions can't be saved).
+ */
+public class OprofileViewSaveDefaultSessionAction extends Action {
+ public OprofileViewSaveDefaultSessionAction() {
+ super(OprofileUiMessages.getString("view.actions.savedefaultsession.label")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ boolean defaultSessionExists = false;
+ UiModelRoot modelRoot = UiModelRoot.getDefault();
+
+ if (modelRoot.hasChildren()) {
+ IUiModelElement[] events = modelRoot.getChildren();
+ for (IUiModelElement e : events) {
+ if (e instanceof UiModelError)
+ break;
+
+ IUiModelElement[] sessions = e.getChildren();
+ for (IUiModelElement s : sessions) {
+ if (((UiModelSession)s).isDefaultSession()) {
+ defaultSessionExists = true;
+ break;
+ }
+ }
+ if (defaultSessionExists)
+ break;
+ }
+ }
+
+ if (defaultSessionExists) {
+ //the following code was originially written by Keith Seitz
+ InputDialog dialog = new InputDialog(OprofileUiPlugin.getActiveWorkbenchShell(),
+ OprofileUiMessages.getString("savedialog.title"), //$NON-NLS-1$
+ OprofileUiMessages.getString("savedialog.message"), //$NON-NLS-1$
+ OprofileUiMessages.getString("savedialog.initial"), //$NON-NLS-1$
+ new SaveSessionValidator());
+
+ int result = dialog.open();
+ if (result == Window.OK) {
+ try {
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().saveSession(dialog.getValue());
+ OprofileUiPlugin.getDefault().getOprofileView().refreshView();
+ } catch (OpcontrolException oe) {
+ OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
+ }
+ }
+ } else {
+ MessageDialog.openError(OprofileUiPlugin.getActiveWorkbenchShell(),
+ OprofileUiMessages.getString("defaultsessiondialog.nodefaultsession.title"), //$NON-NLS-1$
+ OprofileUiMessages.getString("defaultsessiondialog.nodefaultsession.message")); //$NON-NLS-1$
+ }
+ }
+
+ //Original author: Keith Seitz <keiths@redhat.com>
+ private class SaveSessionValidator implements IInputValidator {
+ public String isValid(String newText) {
+ // Sanity check
+ if (newText.length() == 0) {
+ return ""; //$NON-NLS-1$
+ }
+
+ // Cannot contain invalid characters
+ int index = newText.indexOf('/');
+ if (index == -1) {
+ index = newText.indexOf('\\');
+ }
+
+ if (index != -1) {
+ String format = OprofileUiMessages.getString("savedialog.validator.invalidChar"); //$NON-NLS-1$
+ Object[] fmtArgs = new Object[] { newText.substring(index, index + 1), newText };
+ return MessageFormat.format(format, fmtArgs);
+ }
+
+ // Cannot contain whitespace
+ if (newText.contains(" ") || newText.contains("\t")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String format = OprofileUiMessages.getString("savedialog.validator.containsWhitespace"); //$NON-NLS-1$
+ Object[] fmtArgs = new Object[] { newText };
+ return MessageFormat.format(format, fmtArgs);
+ }
+
+ // Must not already exist (opcontrol doesn't allow it)
+ File file = new File(Oprofile.getDefaultSamplesDirectory(), newText);
+ if (file.exists()) {
+ String format = OprofileUiMessages.getString("savedialog.validator.exists"); //$NON-NLS-1$
+ Object[] fmtArgs = new Object[] { newText };
+ return MessageFormat.format(format, fmtArgs);
+ }
+
+ // Everything OK
+ return null;
+ }
+ };
+}

Back to the top