Even the shell becones faster if builtins are used: let the read command read the fields into variables, use $(( )) rather than expr, write the output file in one stream.
This User Gave Thanks to MadeInGermany For This Post:
I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Hi Guys,
I need to write a script capable of identifying when a high cpu utilitzation process. It sounds simple but we are on a AIX 5.3 environment with Virtual CPU's (VP's) and logical CPU's. Please any ideas or tips would be highly appreciated. Thanks.
Harby. (6 Replies)
Hi all
can any one help me to script monitoring
CPU load avg when reaches threshold value
and disk usage if it exceeds some %
tried using awk but when df -h out put is in two different lines awk doesnt work for the particular output in two different line ( output for df -h is in two... (7 Replies)
Hi Experts,
I am executing multiple instances(in parallel) of perl script on HP-UX box.
OS is allocating substantial amount of CPU to these perl processes,resulting higher cpu utilization.
Glance always shows perl processes are occupying majority of the CPU resource. It is causing slower... (2 Replies)
I am looking for a way to log and graphically display cpu and RAM usage of linux processes over time. Since I couldn't find a simple tool to so (I tried zabbix and munin but installation failed) I started writing a shell script to do so
The script file parses the output of top command through... (2 Replies)
Hi All,
I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide
which cpu number (column 2) has maximum value (column 6).
Since the output is displayed/updated every seconds, it's very... (1 Reply)
Hello Friends,
I am trying to create a shell script which will check the CPU utilization. I use command top to check the %CPU usage. It give s me below output
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 0.31 9.6% 0.0% 6.1% 84.3% 0.0% 0.0%... (3 Replies)
Hi all
I was wondering if its possible to write a script to keep CPU usage at 90%-95%? for a single cpu linux server?
I have a perl script I run on servers with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area. I now need a script that raises the CPU to... (4 Replies)
Hi All,
Am very new to Linux and unix ...need below help .
need to list of process consuming more than 40% cpu and which are older than 10 days of a particular user ....
Thanks
V (4 Replies)
I'm a newbie to shell scripting, I was given this script to modify. This script that monitors when CPU Usage is too high based off the top command. The comparison is not working as it should. Its comparing a decimal to a regualar interger. When it send me an email, it send an email and ignores the... (21 Replies)
Discussion started by: mhannor
21 Replies
LEARN ABOUT DEBIAN
giieventselect
giiEventPoll(3) GGI giiEventPoll(3)NAME
giiEventPoll, giiEventSelect, giiEventsQueued, giiEventRead - Wait for and receive events
SYNOPSIS
#include <ggi/gii.h>
gii_event_mask giiEventPoll(gii_input_t inp, gii_event_mask mask,
struct timeval *t);
int giiEventSelect(gii_input_t inp, gii_event_mask *mask, int n,
fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout);
int giiEventsQueued(gii_input_t inp, gii_event_mask mask);
int giiEventRead(gii_input_t inp, gii_event *ev, gii_event_mask mask);
DESCRIPTION
giiEventPoll waits for specific events to become available on an input. This call somewhat resembles the Unix select(2) call, but only for
LibGII events and is more portable. The function returns after an event matching the given event mask is available or after the amount of
time specified by t has elapsed, whichever occurs first. If t is NULL, there is no timeout.
The timeout value on return is updated to the time that would have been remaining. So make sure to re-setup this value when calling
giiEventPoll in a loop.
giiEventSelect is the combination of giiEventPoll and select(2) allowing to wait for both LibGII events and arbitrary file descriptors in
any of the three states. However, this function is not available if the operating system does not support the select(2) call, not even as
a stub.
giiEventsQueued returns the number of events matching the specified event mask that are currently queued in the input.
giiEventRead blocks for and transfers an event from the given input to the location pointed to by ev. The event with the earliest timestamp
that matches the given mask is returned to the application.
RETURN VALUE
giiEventPoll returns a mask of available events (constrained by the given mask). It is 0 if no events are available. On error, an nega-
tive gii-error(3) code is returned.
giiEventSelect returns the same values as select(2). Unlike other LibGGI/LibGII functions, it also uses errno. It will update the timeout
regardless of whether or not the system call does so.
giiEventsQueued returns the number of events.
giiEventRead returns the size of event on success, and 0 on error.
EXAMPLES
This is one of the various ways of coding an event-polling loop:
for(;;) {
tv.tv_sec = 0;
tv.tv_usec = 100; /* change to 0 for non-blocking behaviour */
ggiEventPoll(vis, emAll, &tv);
n = ggiEventsQueued(vis, emAll);
/* Process events in one gulp, when available */
while(n--) {
ggiEventRead(vis, &ggievent, emAll);
switch(ggievent.any.type) {
/* ... */
}
}
/* Do other stuff */
}
Note: This code uses the LibGGI functions and types instead of the LibGII ones, since the former is the more common case.
libgii-1.0.x 2006-12-30 giiEventPoll(3)