/*
* Copyright 2009, Intel Corporation
* Copyright 2009, Sun Microsystems, Inc
*
* This file is part of PowerTOP
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program in a file named COPYING; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authors:
* Arjan van de Ven <arjan@linux.intel.com>
* Eric C Saxe <eric.saxe@sun.com>
* Aubrey Li <aubrey.li@intel.com>
*/
/*
* GPL Disclaimer
*
* For the avoidance of doubt, except that if any license choice other
* than GPL or LGPL is available it will apply instead, Sun elects to
* use only the General Public License version 2 (GPLv2) at this time
* for any software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later
* version may be used, or where a choice of which version of the GPL
* is applied is otherwise unspecified.
*/
#include <string.h>
#include <stdlib.h>
#include <dtrace.h>
#include "powertop.h"
/*ARGSUSED*/
static int
{
uint64_t n = 0;
int i;
char *offense_name;
if (g_top_events >= EVENT_NUM_MAX)
return (0);
/*
* Report interrupts
*/
/* LINTED - alignment */
/*
* Report kernel events
*/
/*
* Casting offender_addr to the wrong type will cause
* dtrace_lookup_by_addr to return 0 and the report
* to show an address instead of a name.
*/
switch (g_bit_depth) {
case 32:
/* LINTED - alignment */
rec1->dtrd_offset);
break;
case 64:
/* LINTED - alignment */
rec1->dtrd_offset);
break;
}
/*
* We have the address of the kernel callout.
* Try to resolve it into a meaningful symbol
*/
} else {
}
/*
* Report user events
*/
EVENT_NAME_MAX, "<scheduled timeout expiration>");
/*
* Report cross calls
*/
switch (g_bit_depth) {
case 32:
/* LINTED - alignment */
rec2->dtrd_offset);
break;
case 64:
/* LINTED - alignment */
rec2->dtrd_offset);
break;
}
/*
* Try to resolve the address of the cross call function.
*/
EVENT_NAME_MAX, "<xcalls> %s`%s",
} else {
EVENT_NAME_MAX, "<xcalls>");
}
/*
* Report cross calls from other CPUs than the one we're observing
* with the -C option
*/
switch (g_bit_depth) {
case 32:
/* LINTED - alignment */
rec2->dtrd_offset);
break;
case 64:
/* LINTED - alignment */
rec2->dtrd_offset);
break;
}
/* LINTED - alignment */
rec3->dtrd_offset);
/*
* Try to resolve the address of the cross call function.
*/
EVENT_NAME_MAX, "<xcalls> %s`%s (CPU %d)",
} else {
EVENT_NAME_MAX, "<xcalls> (CPU %d)",
*offender_cpu);
}
/*
* Report unknown events
*/
} else {
}
for (i = 0; i < g_ncpus; i++) {
/* LINTED - alignment */
}
event->total_count = n;
event++;
g_top_events++;
return (DTRACE_AGGWALK_NEXT);
}
int
pt_events_stat_prepare(void)
{
int err;
char *prog_ptr;
pt_error("cannot open dtrace library for the event report: "
return (-1);
}
/*
* Execute different scripts (defined in the platform specific file)
* depending on user specified options.
*/
if (PT_ON_VERBOSE) {
prog_ptr = (char *)g_dtp_events_v;
} else {
if (PT_ON_CPU)
prog_ptr = (char *)g_dtp_events_c;
else
prog_ptr = (char *)g_dtp_events;
}
pt_error("failed to compile the event report program\n");
return (dtrace_errno(dtp));
}
pt_error("failed to enable probes for the event report\n");
return (dtrace_errno(dtp));
}
pt_error("failed to set 'aggsize' for the event report\n");
return (dtrace_errno(dtp));
}
pt_error("failed to set 'aggrate' for the event report\n");
return (dtrace_errno(dtp));
}
pt_error("failed to set 'aggpercpu' for the event report\n");
return (dtrace_errno(dtp));
}
pt_error("failed to start the event report observation\n");
return (dtrace_errno(dtp));
}
pt_error("failed to get 'statusrate' for the event report\n");
return (dtrace_errno(dtp));
}
return (0);
}
int
pt_events_stat_collect(void)
{
g_top_events = 0;
return (-1);
if (dtrace_aggregate_snap(dtp) != 0)
pt_error("failed to collect data for the event report\n");
pt_error("failed to sort data for the event report\n");
return (0);
}