2011-05-01 10:22:54 +04:00
|
|
|
/* $NetBSD: rf_acctrace.c,v 1.24 2011/05/01 06:22:54 mrg Exp $ */
|
1998-11-13 07:20:26 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1995 Carnegie-Mellon University.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Mark Holland
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*****************************************************************************
|
1999-02-05 03:06:06 +03:00
|
|
|
*
|
1998-11-13 07:20:26 +03:00
|
|
|
* acctrace.c -- code to support collecting information about each access
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
2001-11-13 10:11:12 +03:00
|
|
|
#include <sys/cdefs.h>
|
2011-05-01 10:22:54 +04:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.24 2011/05/01 06:22:54 mrg Exp $");
|
2001-11-13 10:11:12 +03:00
|
|
|
|
1998-11-13 07:20:26 +03:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
2001-10-04 19:58:51 +04:00
|
|
|
#include <dev/raidframe/raidframevar.h>
|
1998-11-13 07:20:26 +03:00
|
|
|
|
1999-01-26 05:33:49 +03:00
|
|
|
#include "rf_threadstuff.h"
|
1998-11-13 07:20:26 +03:00
|
|
|
#include "rf_debugMem.h"
|
|
|
|
#include "rf_acctrace.h"
|
|
|
|
#include "rf_general.h"
|
|
|
|
#include "rf_raid.h"
|
|
|
|
#include "rf_etimer.h"
|
|
|
|
#include "rf_hist.h"
|
|
|
|
#include "rf_shutdown.h"
|
|
|
|
|
2004-03-01 00:38:41 +03:00
|
|
|
#if RF_ACC_TRACE > 0
|
1998-11-13 07:20:26 +03:00
|
|
|
static long numTracesSoFar;
|
|
|
|
|
2011-05-01 10:22:54 +04:00
|
|
|
rf_declare_mutex2(rf_tracing_mutex);
|
|
|
|
|
|
|
|
static void
|
|
|
|
rf_ShutdownAccessTrace(void *unused)
|
|
|
|
{
|
|
|
|
rf_destroy_mutex2(rf_tracing_mutex);
|
|
|
|
}
|
1998-11-13 07:20:26 +03:00
|
|
|
|
2005-02-27 03:26:58 +03:00
|
|
|
int
|
2006-11-16 04:32:37 +03:00
|
|
|
rf_ConfigureAccessTrace(RF_ShutdownList_t **listp)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
1999-02-05 03:06:06 +03:00
|
|
|
numTracesSoFar = 0;
|
2011-05-01 10:22:54 +04:00
|
|
|
rf_init_mutex2(rf_tracing_mutex, IPL_VM);
|
|
|
|
rf_ShutdownCreate(listp, rf_ShutdownAccessTrace, NULL);
|
2003-12-30 20:29:41 +03:00
|
|
|
return (0);
|
1998-11-13 07:20:26 +03:00
|
|
|
}
|
2004-03-01 00:38:41 +03:00
|
|
|
|
2004-02-29 23:47:37 +03:00
|
|
|
/* install a trace record. cause a flush to disk or to the trace
|
2005-02-27 03:26:58 +03:00
|
|
|
* collector daemon if the trace buffer is at least 1/2 full.
|
1998-11-13 07:20:26 +03:00
|
|
|
*/
|
2005-02-27 03:26:58 +03:00
|
|
|
void
|
2003-12-31 00:59:03 +03:00
|
|
|
rf_LogTraceRec(RF_Raid_t *raid, RF_AccTraceEntry_t *rec)
|
1998-11-13 07:20:26 +03:00
|
|
|
{
|
|
|
|
RF_AccTotals_t *acc = &raid->acc_totals;
|
|
|
|
|
2003-12-30 20:29:41 +03:00
|
|
|
if (((rf_maxNumTraces >= 0) && (numTracesSoFar >= rf_maxNumTraces)))
|
1999-02-05 03:06:06 +03:00
|
|
|
return;
|
1998-11-13 07:20:26 +03:00
|
|
|
|
|
|
|
/* update AccTotals for this device */
|
|
|
|
if (!raid->keep_acc_totals)
|
|
|
|
return;
|
|
|
|
acc->num_log_ents++;
|
|
|
|
if (rec->reconacc) {
|
|
|
|
acc->recon_start_to_fetch_us += rec->specific.recon.recon_start_to_fetch_us;
|
|
|
|
acc->recon_fetch_to_return_us += rec->specific.recon.recon_fetch_to_return_us;
|
|
|
|
acc->recon_return_to_submit_us += rec->specific.recon.recon_return_to_submit_us;
|
|
|
|
acc->recon_num_phys_ios += rec->num_phys_ios;
|
|
|
|
acc->recon_phys_io_us += rec->phys_io_us;
|
|
|
|
acc->recon_diskwait_us += rec->diskwait_us;
|
|
|
|
acc->recon_reccount++;
|
1999-02-05 03:06:06 +03:00
|
|
|
} else {
|
1998-11-13 07:20:26 +03:00
|
|
|
RF_HIST_ADD(acc->tot_hist, rec->total_us);
|
|
|
|
RF_HIST_ADD(acc->dw_hist, rec->diskwait_us);
|
1999-02-05 03:06:06 +03:00
|
|
|
/* count of physical ios which are too big. often due to
|
|
|
|
* thermal recalibration */
|
1998-11-13 07:20:26 +03:00
|
|
|
/* if bigvals > 0, you should probably ignore this data set */
|
|
|
|
if (rec->diskwait_us > 100000)
|
|
|
|
acc->bigvals++;
|
|
|
|
acc->total_us += rec->total_us;
|
|
|
|
acc->suspend_ovhd_us += rec->specific.user.suspend_ovhd_us;
|
|
|
|
acc->map_us += rec->specific.user.map_us;
|
|
|
|
acc->lock_us += rec->specific.user.lock_us;
|
|
|
|
acc->dag_create_us += rec->specific.user.dag_create_us;
|
|
|
|
acc->dag_retry_us += rec->specific.user.dag_retry_us;
|
|
|
|
acc->exec_us += rec->specific.user.exec_us;
|
|
|
|
acc->cleanup_us += rec->specific.user.cleanup_us;
|
|
|
|
acc->exec_engine_us += rec->specific.user.exec_engine_us;
|
|
|
|
acc->xor_us += rec->xor_us;
|
|
|
|
acc->q_us += rec->q_us;
|
|
|
|
acc->plog_us += rec->plog_us;
|
|
|
|
acc->diskqueue_us += rec->diskqueue_us;
|
|
|
|
acc->diskwait_us += rec->diskwait_us;
|
|
|
|
acc->num_phys_ios += rec->num_phys_ios;
|
|
|
|
acc->phys_io_us = rec->phys_io_us;
|
|
|
|
acc->user_reccount++;
|
|
|
|
}
|
|
|
|
}
|
2004-03-02 02:30:57 +03:00
|
|
|
#endif /* RF_ACC_TRACE > 0 */
|
2004-03-01 00:38:41 +03:00
|
|
|
|