/*************************************************************************** * * Copyright (C) 2001 International Business Machines * All rights reserved. * * This file is part of the GPFS mmfslinux kernel module. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************** */ /* @(#)17 1.3 src/avs/fs/mmfs/ts/kernext/gpl-linux/cxiVFSStats.c, mmfs, avs_rgpfs24, rgpfs240610b 10/17/02 21:23:19 */ /* * Linux implementation of VFSStatPoint * */ #include #define DEFINE_VFSSTATS_GBL_VARS /* allocate storage for trace globals */ #include #include #include #include #include #include void VFSStatPoint_begin(VFSStatPoint_t *objPtr, enum VFSStatItem i) { cxiGetTOD(&(objPtr->beginTime)); objPtr->statItem = i; } void VFSStatPoint_end(VFSStatPoint_t *objPtr) { cxiTimeStruc_t endTime; cxiTimeStruc_t t; if (objPtr->statItem != nullCall) { /* Get the current time and store in endTime */ cxiGetTOD(&endTime); /* Calculate the new value of totalTime in vfsStats.data[statItem] as totalTime = totalTime + (endTime - beginTime) */ t.tv_sec = vfsStats.data[objPtr->statItem].totalTime.tv_sec + endTime.tv_sec - objPtr->beginTime.tv_sec; t.tv_nsec = vfsStats.data[objPtr->statItem].totalTime.tv_nsec + endTime.tv_nsec - objPtr->beginTime.tv_nsec; if (t.tv_nsec >= 1000000000) { t.tv_sec++; t.tv_nsec -= 1000000000; } else if (t.tv_nsec < 0) { t.tv_sec--; t.tv_nsec += 1000000000; } /* update the count and value of totalTime in vfsStats.data[statItem] */ vfsStats.data[objPtr->statItem].cnt++; vfsStats.data[objPtr->statItem].totalTime = t; } } #ifdef KCSTRACE void cxiKcsTraceInfo(int index, int value) { current->kcst_info.data[index] = value; } #endif