2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Time structure: Year, Month, Day, Hour, Min, Sec */ 2N/A/* Used to create the [gnu]plot file */ 2N/A/* Time sorted list */ 2N/A/* The parsed table */ 2N/A * Optimization I : List sorted by time, i.e: 2N/A * ------------------------------- 2N/A * Optimization II : List sorted by resources 2N/A * ------------------------------- 2N/A /* Common to both the above (sorted) lists. */ 2N/A * Given a timebuf of the form M/D/Y,H:M:S break it into individual elements. 2N/A/* Get a stat item from an object in the exacct file */ 2N/A/* Get a description item from an object in the exacct file */ 2N/A/* Add a description item to the table */ 2N/A/* Compare dates and return if t1 is equal, greater or lesser than t2 */ 2N/A/* Compare times and return if t1 is equal, greater or lesser than t2 */ 2N/A * Given a start and end time and start and end entries check if the 2N/A * times are within the range, and adjust, if needed. 2N/A * Given a start and end time (strings), convert them into net_time_t 2N/A * and also check for the range given the head and tail of the list. 2N/A * If stime is lower then head or etime is greated than tail, adjust. 2N/A * Walk the list from a given starting point and return when we find 2N/A * an entry that is greater or equal to st. lasttime will point to the 2N/A * previous time entry. 2N/A * Point entry (pe) functions 2N/A/* Clear all the counters. Done after the contents are written to the file */ 2N/A/* Update an entry in the point entry table */ 2N/A/* Flush the contents of the point entry table to the file. */ 2N/A * Net entry functions 2N/A/* Get the entry for the descriptor, if it exists */ 2N/A * Update the stat entries. The stats in the file are cumulative, so in order 2N/A * to have increments, we maintain a reference stat entry, which contains 2N/A * the stats when the record was first written and a total stat entry, which 2N/A * maintains the running count. When we want to add a stat entry, if it 2N/A * the reference stat entry, we don't come here. For subsequent entries, 2N/A * we get the increment by subtracting the current value from the reference 2N/A * stat and the total stat. 2N/A /* get the increment */ 2N/A /* update total bytes */ 2N/A/* Add the stat entry into the table */ 2N/A /* Ptr to flow desc */ 2N/A/* Make an entry into the time sorted list */ 2N/A /* Just add it to the tail */ 2N/A/* Add stat entry into the lists */ 2N/A/* Free the entire table */ 2N/A/* Parse the exacct file, and return the parsed table. */ 2N/A /* Flow Descriptor */ 2N/A /* Link Descriptor */ 2N/A * Walk the ctime list. This is used when looking for usage records 2N/A * based on a "resource" name. 2N/A /* Parse the log file */ 2N/A /* Get to the resource we are interested in */ 2N/A /* Find the first record */ 2N/A /* Write one entry and return if we are out of the range */ 2N/A * If this is a reference entry, just print what we have 2N/A * Walk the time sorted list if a resource is not specified. 2N/A /* Parse the log file */ 2N/A /* Find the first and last records and starting point */ 2N/A * Could assert to be non-null, since get_time_range() 2N/A * would have adjusted. 2N/A * Collect entries for all resources in a time slot before 2N/A * writing to the file. 2N/A /* Write header to file */ 2N/A /* add_pe_to_file(fn, pe, ns, nentries, arg); */ 2N/A * We have crossed the time boundary, check if we need to 2N/A /* return if we are out of the range */ 2N/A /* update the stats from the ns. */ 2N/A * if this is a reference entry, just print what we have 2N/A * for this resource and proceed. We will end up writing 2N/A * the stats for all the entries when we hit a ref element, 2N/A * which means 'steps' for some might not be accurate, but 2N/A * that is fine, the alternative is to write only the 2N/A * resource for which we hit a reference entry. 2N/A /* Parse the log file */ 2N/A * Walk the ctime list and display the dates of the records. 2N/A /* Parse the log file */ 2N/A /* get to the resource we are interested in */ 2N/A /* get the starting point in the logfile */