File: resuse.h

package info (click to toggle)
time 1.7-25.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 760 kB
  • ctags: 284
  • sloc: ansic: 2,811; sh: 232; makefile: 27
file content (58 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* resuse.h - declarations for child process resource use library
   Copyright (C) 1993, 1996 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   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; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#ifndef _RESUSE_H
#define _RESUSE_H 1

#if HAVE_TIMEVAL
# include <sys/time.h>
#else
/* High resolution clock structure.  */
struct timeval
{
  long tv_sec;			/* Seconds.  */
  long tv_usec;			/* Microseconds.  */
};
#endif

#if HAVE_SYS_RUSAGE_H
/* This rusage structure measures nanoseconds instead of microseconds.  */
# define TV_MSEC tv_nsec / 1000000
# include <sys/rusage.h>
#else
# define TV_MSEC tv_usec / 1000
# if HAVE_SYS_RESOURCE_H
#  include <sys/resource.h>
# endif
#endif

/* Information on the resources used by a child process.  */
typedef struct
{
  int waitstatus;
  struct rusage ru;
  struct timeval start, elapsed; /* Wallclock time of process.  */
} RESUSE;

/* Prepare to measure a child process.  */
void resuse_start PARAMS ((RESUSE *resp));

/* Wait for and fill in data on child process PID.  */
int resuse_end PARAMS ((pid_t pid, RESUSE *resp));

#endif /* _RESUSE_H */