Displaying 8 results from an estimated 8 matches for "rusage_self".
2006 Mar 02
1
Failing to understand getrusage()
...sage() before and after allocating 1MB of RAM, and see what
the maxrss figure is */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
int
main(void)
{
struct rusage ru;
char *ptr;
int rc;
rc = getrusage(RUSAGE_SELF, &ru);
if(rc == -1) {
perror("getrusage(): ");
return 1;
}
printf("before: %ld, ", ru.ru_maxrss);
ptr = malloc(1024 * 1024);
if(ptr == NULL) {
perror("malloc(): ");
return 1;
}
memset(ptr, 0, 1024 * 1024); /* Zero-fill the memory */
rc = getrusag...
2000 Jun 15
1
problem in entropy.c if no getrusage
entropy.c assumes RUSAGE_SELF and RUSAGE_CHILDREN
*** entropy.c.orig Thu Jun 15 13:57:28 2000
--- entropy.c Thu Jun 15 13:58:25 2000
***************
*** 201,207 ****
--- 201,209 ----
total_entropy_estimate += stir_gettimeofday(1.0);
total_entropy_estimate += stir_clock(0.2);
+ #ifdef HAVE_GETRUSAGE...
2009 Aug 12
0
Problem with Linux x86_64 RODBC and Netezza (PR#13889)
...uot;P\0\0\0\5select identifier_case, cur"..., 59, 0, NULL, 0) = 59
recvfrom(3, "P\0\0\0\5\0\0\0\6blank\0T\0\0\0\5\0\0\0P\0\3IDENTI"..., 16384, 0,
NULL, NULL) = 174
write(1, "> ", 2) = 2
write(1, "conn\n", 5) = 5
getrusage(RUSAGE_SELF, {ru_utime={0, 357945}, ru_stime={0, 82987}, ...}) = 0
getrusage(RUSAGE_CHILDREN, {ru_utime={0, 0}, ru_stime={0, 999}, ...}) = 0
write(1, "RODBC Connection ", 17) = 17
write(1, "1", 1) = 1
write(1, "\nDetails:\n ", 12) = 12
write(...
2000 Nov 02
2
misc. minor patches
...rig/entropy.c Wed Jun 7 08:20:23 2000
+++ openssh-2.1.1p1/entropy.c Thu Jun 15 13:58:25 2000
@@ -201,7 +201,9 @@
total_entropy_estimate += stir_gettimeofday(1.0);
total_entropy_estimate += stir_clock(0.2);
+#ifdef HAVE_GETRUSAGE
total_entropy_estimate += stir_rusage(RUSAGE_SELF, 2.0);
+#endif
return(total_entropy_estimate);
}
@@ -247,8 +249,10 @@
/* Execution times should be a little unpredictable */
total_entropy_estimate += stir_gettimeofday(0.05);
total_entropy_estimate +=...
2010 Oct 04
0
Python resource module returns just zeros
I'm using a call to the resource module's getrusage method. On openSUSE
this works, on CentOS [python26-2.6.5-3.el5] it 'works' but just returns
zeros for the memory utilization values.
resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
openSUSE: returns 5512
CentOS: returns 0
Anyone know what condition causes this? Or is there a better /
more-reliable way to check memory utilization of the current process [from python]?
--
Adam Tauno Williams <awilliam at whitemice.org> LPIC-1, Novell CLA
<http://www.whi...
2023 Jan 14
1
[klibc:time64] resource: Avoid using <linux/resource.h>
...urce.h
+++ b/usr/include/sys/resource.h
@@ -6,8 +6,39 @@
#define _SYS_RESOURCE_H
#include <klibc/extern.h>
-#include <sys/types.h> /* MUST be included before linux/resource.h */
-#include <linux/resource.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#define RUSAGE_SELF 0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_BOTH (-2)
+#define RUSAGE_THREAD 1
+
+struct rusage {
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
+ __kernel_long_t ru_maxrss; /* maximum resident set size */
+ __kernel_long_t ru_ixrss; /* integra...
2006 Mar 17
1
[PATCH] OpenSSL RNG initialization
...v/urandom, so we can only use weak random sources.
+ */
+ while (RAND_status() != 1) {
+ if (gettimeofday(&tv, NULL) < 0)
+ i_fatal("gettimeofday() failed: %m");
+ RAND_add((const void *)&tv, sizeof(tv),
+ (double)sizeof(tv) / 2);
+#ifdef HAVE_GETRUSAGE
+ if (getrusage(RUSAGE_SELF, &ru) < 0)
+ i_fatal("getrusage() failed: %m");
+ RAND_add((const void *)&ru, sizeof(ru),
+ (double)sizeof(ru) / 2);
+#endif
+
+ if (counter++ > 100)
+ i_fatal("could not get enough entropy");
+ }
+}
+
void random_fill(void *buf, size_t size)
{
if (RAND_b...
2002 Aug 10
3
ext3_readdir error
...t_sigaction(SIGUSR1, {0x8048e40, [], SA_RESTART|0x4000000}, NULL, 8) = 0
rt_sigaction(SIGUSR2, {0x8048e74, [], SA_RESTART|0x4000000}, NULL, 8) = 0
open("/dev/null", O_RDWR) = 3
close(3) = 0
gettimeofday({1028968512, 177653}, NULL) = 0
getrusage(RUSAGE_SELF, {ru_utime={0, 0}, ru_stime={0, 0}, ...}) = 0
write(2, "e2fsck 1.26 (3-Feb-2002)\n", 25e2fsck 1.26 (3-Feb-2002)
) = 25
stat64("/dev/sda1", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 1), ...}) =
0
open("/proc/swaps", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0...