|
Revision 2103, 2.9 kB
(checked in by karpet, 8 months ago)
|
whitespace only. again.
I am now using gnu indent rather than the original bsd version. My opts are below:
--no-blank-lines-after-declarations
--blank-lines-after-procedures
--no-blank-lines-after-commas
--break-before-boolean-operator
//--break-function-decl-args
//--break-function-decl-args-end
// long options above do not work. use short below instead.
-bfda
-bfde
--braces-on-if-line
--brace-indent4
--braces-after-struct-decl-line
--dont-cuddle-else
--comment-delimiters-on-blank-lines
--else-endif-column1
--no-space-after-casts
--declaration-indentation4
--paren-indentation4
--dont-format-first-column-comments
--dont-format-comments
--ignore-newlines
--line-length80
--indent-level4
--parameter-indentation5
--continue-at-parentheses
--no-space-after-function-call-names
--no-space-after-parentheses
--procnames-start-lines
--space-after-for
--space-after-if
--space-after-while
--dont-star-comments
--swallow-optional-blank-lines
--no-tabs
-TxmlChar?
-Tswish_ParserData
-Tswish_Config
-Tswish_3
-Tswish_Analyzer
-Tswish_Parser
-Tswish_DocInfo
-Tswish_TagStack
-Tswish_MetaName
-Tswish_Property
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
#include "acconfig.h" |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
#undef HAVE_GETRUSAGE |
|---|
| 26 |
|
|---|
| 27 |
#undef HAVE_SYS_RESOURCE_H |
|---|
| 28 |
|
|---|
| 29 |
#undef HAVE_TIMES |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
#include "getruntime.h" |
|---|
| 36 |
#include <time.h> |
|---|
| 37 |
|
|---|
| 38 |
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) |
|---|
| 39 |
#include <sys/time.h> |
|---|
| 40 |
#include <sys/resource.h> |
|---|
| 41 |
#endif |
|---|
| 42 |
|
|---|
| 43 |
#ifdef HAVE_TIMES |
|---|
| 44 |
#ifdef HAVE_SYS_PARAM_H |
|---|
| 45 |
#include <sys/param.h> |
|---|
| 46 |
#endif |
|---|
| 47 |
#include <sys/times.h> |
|---|
| 48 |
#endif |
|---|
| 49 |
|
|---|
| 50 |
#ifdef HAVE_UNISTD_H |
|---|
| 51 |
#include <unistd.h> |
|---|
| 52 |
#endif |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
#ifndef CLOCKS_PER_SEC |
|---|
| 58 |
#define CLOCKS_PER_SEC 1 |
|---|
| 59 |
#endif |
|---|
| 60 |
|
|---|
| 61 |
#ifdef _SC_CLK_TCK |
|---|
| 62 |
#define GNU_HZ sysconf(_SC_CLK_TCK) |
|---|
| 63 |
#else |
|---|
| 64 |
#ifdef HZ |
|---|
| 65 |
#define GNU_HZ HZ |
|---|
| 66 |
#else |
|---|
| 67 |
#ifdef CLOCKS_PER_SEC |
|---|
| 68 |
#define GNU_HZ CLOCKS_PER_SEC |
|---|
| 69 |
#endif |
|---|
| 70 |
#endif |
|---|
| 71 |
#endif |
|---|
| 72 |
|
|---|
| 73 |
cpu_seconds |
|---|
| 74 |
get_cpu_secs( |
|---|
| 75 |
) |
|---|
| 76 |
{ |
|---|
| 77 |
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) |
|---|
| 78 |
struct rusage rusage; |
|---|
| 79 |
cpu_seconds secs; |
|---|
| 80 |
|
|---|
| 81 |
getrusage(0, &rusage); |
|---|
| 82 |
secs = (cpu_seconds) (rusage.ru_utime.tv_sec + rusage.ru_stime.tv_sec); |
|---|
| 83 |
|
|---|
| 84 |
if (rusage.ru_utime.tv_usec > 500000) |
|---|
| 85 |
secs++; |
|---|
| 86 |
if (rusage.ru_stime.tv_usec > 500000) |
|---|
| 87 |
secs++; |
|---|
| 88 |
|
|---|
| 89 |
return secs; |
|---|
| 90 |
|
|---|
| 91 |
#else |
|---|
| 92 |
#ifdef HAVE_TIMES |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
struct tms tms; |
|---|
| 99 |
|
|---|
| 100 |
times(&tms); |
|---|
| 101 |
|
|---|
| 102 |
return (cpu_seconds) ((tms.tms_utime + tms.tms_stime) / GNU_HZ); |
|---|
| 103 |
|
|---|
| 104 |
#else |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
clock_t t = clock(); |
|---|
| 110 |
if (t < 0) |
|---|
| 111 |
t = 0; |
|---|
| 112 |
|
|---|
| 113 |
return (cpu_seconds) (t / CLOCKS_PER_SEC); |
|---|
| 114 |
|
|---|
| 115 |
#endif |
|---|
| 116 |
#endif |
|---|
| 117 |
} |
|---|