#!/bin/sh

# $Id: geneventlist,v 1.7 2006/01/21 22:45:36 rkufrin Exp $

############################################################################
#
#                    University of Illinois/NCSA
#                        Open Source License
# 
#          Copyright(C) 2004-2006, The Board of Trustees of the
#              University of Illinois. All rights reserved.
#
#                            Developed by:             
# 
#                        The PerfSuite Project
#            National Center for Supercomputing Applications
#              University of Illinois at Urbana-Champaign
# 
#                   http://perfsuite.ncsa.uiuc.edu/
# 
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal with the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, 
# and/or sell copies of the Software, and to permit persons to whom the 
# Software is furnished to do so, subject to the following conditions:
# 
# + Redistributions of source code must retain the above copyright notice, 
#   this list of conditions and the following disclaimers.
# + Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimers in
#   the documentation and/or other materials provided with the distribution.
# + Neither the names of The PerfSuite Project, NCSA/University of Illinois
#   at Urbana-Champaign, nor the names of its contributors may be used to
#   endorse or promote products derived from this Software without specific
#   prior written permission.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
# CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
# DEALINGS WITH THE SOFTWARE.
############################################################################

# geneventlist: example shell script that generates an XML document
#               containing all available PAPI standard events
#               (excluding PAPI 2 rate events) that can be used
#               as a starting point for psrun or libpshwpc
#
# Author: Rick Kufrin
# Date:   5/30/2004
#
# This file is part of PerfSuite.

echo '<?xml version="1.0" encoding="UTF-8" ?>'
echo '<ps_hwpc_eventlist class="PAPI">'
for event in ` psinv -p | grep PAPI_ | egrep -v '(FLOPS|IPS)' | sed 's/:.*$//' | sort`
do
    echo "	<ps_hwpc_event type=\"preset\" name=\"$event\" />"
done
echo '</ps_hwpc_eventlist>'

exit 0
