Skip to main content
aboutsummaryrefslogtreecommitdiffstats
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>
+ <sectio