Compare commits
8 Commits
LIBGTOP_2_
...
LIBGTOP_2_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d07192b5c9 | ||
|
|
b6464a97ec | ||
|
|
89aac22fac | ||
|
|
935d321bf0 | ||
|
|
9ea7201e24 | ||
|
|
f4089fa71f | ||
|
|
ab3f8f58ef | ||
|
|
e5fdd58fee |
8
NEWS
8
NEWS
@@ -1,3 +1,11 @@
|
||||
12 January 2009: Overview of changes in 2.24.3
|
||||
==============================================
|
||||
* linux:
|
||||
- fixed potential memory leak. Vincent Untz.
|
||||
- fixed read(2) usage. Should fix the missing cpus bug in system-monitor.
|
||||
* darwin:
|
||||
- fixed build. "paul".
|
||||
|
||||
22 Septembre 2008: Overview of changes in 2.24.0
|
||||
================================================
|
||||
* Translation updates.
|
||||
|
||||
@@ -4,7 +4,7 @@ dnl
|
||||
|
||||
m4_define([libgtop_major_version], [2])
|
||||
m4_define([libgtop_minor_version], [24])
|
||||
m4_define([libgtop_micro_version], [0])
|
||||
m4_define([libgtop_micro_version], [3])
|
||||
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
|
||||
|
||||
dnl increment if the interface has additions, changes, removals.
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef PROFILE_COUNT_EXPENSIVE
|
||||
#define PROFILE_COUNT_EXPENSIVE 10000L
|
||||
#define PROFILE_COUNT_EXPENSIVE (PROFILE_COUNT / 10)
|
||||
#endif
|
||||
|
||||
#define ELAPSED_UTIME ((unsigned long) elapsed_utime.tv_sec * 1000000 + (unsigned long) elapsed_utime.tv_usec)
|
||||
@@ -73,13 +73,13 @@ int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
glibtop_union data;
|
||||
unsigned c, count;
|
||||
unsigned c;
|
||||
struct rusage total_start, total_end;
|
||||
struct rusage rusage_start, rusage_end;
|
||||
struct timeval elapsed_utime, elapsed_stime;
|
||||
pid_t pid, *ptr;
|
||||
pid_t pid;
|
||||
|
||||
count = PROFILE_COUNT;
|
||||
pid = getpid ();
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (GETTEXT_PACKAGE, GTOPLOCALEDIR);
|
||||
@@ -184,12 +184,10 @@ main (int argc, char *argv [])
|
||||
(long double) ELAPSED_UTIME / PROFILE_COUNT,
|
||||
(long double) ELAPSED_STIME / PROFILE_COUNT);
|
||||
|
||||
printf ("\n");
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++) {
|
||||
ptr = glibtop_get_proclist (&data.proclist, 0, 0);
|
||||
pid_t* ptr = glibtop_get_proclist (&data.proclist, 0, 0);
|
||||
g_free (ptr);
|
||||
}
|
||||
|
||||
@@ -207,9 +205,26 @@ main (int argc, char *argv [])
|
||||
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
|
||||
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
|
||||
|
||||
pid = getpid ();
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
printf ("\n");
|
||||
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++) {
|
||||
char** ptr = glibtop_get_netlist (&data.netlist);
|
||||
g_strfreev (ptr);
|
||||
}
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_end);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
|
||||
&elapsed_utime);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
|
||||
&elapsed_stime);
|
||||
|
||||
printf ("Netlist (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
|
||||
(unsigned long) data.proclist.flags,
|
||||
PROFILE_COUNT_EXPENSIVE,
|
||||
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
|
||||
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
@@ -267,6 +282,27 @@ main (int argc, char *argv [])
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++) {
|
||||
glibtop_map_entry* entries;
|
||||
entries = glibtop_get_proc_map (&data.proc_map, pid);
|
||||
g_free (entries);
|
||||
}
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_end);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
|
||||
&elapsed_utime);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
|
||||
&elapsed_stime);
|
||||
|
||||
printf ("Proc_Map (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
|
||||
(unsigned long) data.proc_map.flags, PROFILE_COUNT_EXPENSIVE,
|
||||
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
|
||||
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||
|
||||
@@ -285,6 +321,27 @@ main (int argc, char *argv [])
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++) {
|
||||
char** argv;
|
||||
argv = glibtop_get_proc_argv (&data.proc_args, pid, 0);
|
||||
g_strfreev(argv);
|
||||
}
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_end);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
|
||||
&elapsed_utime);
|
||||
|
||||
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
|
||||
&elapsed_stime);
|
||||
|
||||
printf ("Proc_Args (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
|
||||
(unsigned long) data.proc_args.flags, PROFILE_COUNT,
|
||||
(long double) ELAPSED_UTIME / PROFILE_COUNT,
|
||||
(long double) ELAPSED_STIME / PROFILE_COUNT);
|
||||
|
||||
getrusage (RUSAGE_SELF, &rusage_start);
|
||||
|
||||
for (c = 0; c < PROFILE_COUNT; c++)
|
||||
glibtop_get_proc_time (&data.proc_time, pid);
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
|
||||
libgtop_use_machine_h=yes
|
||||
libgtop_need_server=yes
|
||||
libgtop_have_sysinfo=yes
|
||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server && chmod g+s $(bindir)/libgtop_server2'
|
||||
libgtop_postinstall='chgrp kmem $(bindir)/libgtop_server2 && chmod g+s $(bindir)/libgtop_server2'
|
||||
;;
|
||||
*)
|
||||
if test x$hacker_mode = xyes ; then
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2008-10-19 Djihed Afifi <djihed@gmail.com>
|
||||
|
||||
* ar.po: Updated Arabic Translation by Khaled Hosny.
|
||||
|
||||
2008-09-20 Laurent Dhima <laurenti@alblinux.net>
|
||||
|
||||
* sq.po: Updated Albanian Translation.
|
||||
|
||||
@@ -6,7 +6,7 @@ libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c
|
||||
|
||||
libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c \
|
||||
cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||
sem_limits.c proclist.c procstate.c procuid.c proctime.c \
|
||||
sem_limits.c procaffinity.c proclist.c procstate.c procuid.c proctime.c \
|
||||
procmem.c procsignal.c prockernel.c procsegment.c procargs.c \
|
||||
procmap.c netload.c ppp.c netlist.c procopenfiles.c procwd.c
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ G_BEGIN_DECLS
|
||||
#define GLIBTOP_SUID_NETLIST 0
|
||||
#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
|
||||
#define GLIBTOP_SUID_PROC_WD (1 << GLIBTOP_SYSDEPS_PROC_WD)
|
||||
#define GLIBTOP_SUID_PROC_AFFINITY 0
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -129,29 +129,29 @@ get_sys_path(glibtop* server, const char *device, char **stat_path, const char *
|
||||
|
||||
static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path)
|
||||
{
|
||||
char *filename;
|
||||
char *filename = NULL;
|
||||
const char *format;
|
||||
int ret;
|
||||
char buffer[BUFSIZ];
|
||||
char device[64];
|
||||
|
||||
if (!get_device(server, path, device, sizeof device))
|
||||
return;
|
||||
goto out;
|
||||
|
||||
get_sys_path(server, device, &filename, &format);
|
||||
|
||||
ret = try_file_to_buffer(buffer, sizeof buffer, filename);
|
||||
|
||||
if(ret < 0) return;
|
||||
if (ret < 0) goto out;
|
||||
|
||||
if (sscanf(buffer, format, &buf->read, &buf->write) != 2) {
|
||||
glibtop_warn_io_r(server, "Could not parse %s", filename);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_free(filename);
|
||||
|
||||
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
|
||||
out:
|
||||
g_free(filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,14 +67,18 @@ enum TRY_FILE_TO_BUFFER
|
||||
TRY_FILE_TO_BUFFER_READ = -2
|
||||
};
|
||||
|
||||
/*
|
||||
* Doesn't handle bufsiz == 0
|
||||
*/
|
||||
int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
||||
{
|
||||
char path[4096];
|
||||
int fd;
|
||||
ssize_t len;
|
||||
size_t len = 0;
|
||||
ssize_t nread = 0;
|
||||
va_list pa;
|
||||
|
||||
if (bufsiz <= sizeof(char*))
|
||||
if (G_UNLIKELY(bufsiz <= sizeof(char*)))
|
||||
g_warning("Huhu, bufsiz of %lu looks bad", (gulong)bufsiz);
|
||||
|
||||
va_start(pa, format);
|
||||
@@ -84,15 +88,31 @@ int try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...)
|
||||
|
||||
va_end(pa);
|
||||
|
||||
bufsiz--; /* reserve 1 for trailing NUL */
|
||||
buffer [0] = '\0';
|
||||
|
||||
if((fd = open (path, O_RDONLY)) < 0)
|
||||
return TRY_FILE_TO_BUFFER_OPEN;
|
||||
|
||||
len = read (fd, buffer, bufsiz - 1);
|
||||
while (len < bufsiz) {
|
||||
nread = read (fd, buffer + len, bufsiz - len);
|
||||
|
||||
if (G_UNLIKELY(nread < 0)) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
len += nread;
|
||||
|
||||
if (nread == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
if (len < 0)
|
||||
if (nread < 0)
|
||||
return TRY_FILE_TO_BUFFER_READ;
|
||||
|
||||
buffer [len] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user