Sponsored Content
Full Discussion: Finding Average for BST
Top Forums Programming Finding Average for BST Post 47805 by Perderabo on Thursday 19th of February 2004 07:13:35 AM
Old 02-19-2004
Actually, it would be nice if posters would read our rules and follow them. This thread is closed.
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

How to find no of occurances Finding average time?

Hi, I have MyLog.log file, and it contains "*** response Time 150", I want to develop Unix script like , 1. extract all such occurances in the MyLog.log file and 2. compute the average time taken I am new to Unix, any one can give any idea/sample code for this? Thanks in advance. (1 Reply)
Discussion started by: redlotus72
1 Replies

2. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

3. UNIX for Dummies Questions & Answers

average value

If I have a file like this, could anyone please guide me how to find the average value in each metrix. The file has got about 130,000 metrixs. Grid-ref= 142, 235 178 182 203 240 273 295 289 293 283 262 201 176 167 187 187 246 260 282 299 312 293 276 230 191 169 ... (2 Replies)
Discussion started by: su_in99
2 Replies

4. HP-UX

change time mode from BST to GMT

I want to know how to change the time zone from BST to GMT avoid the daylight savings in hp-ux (3 Replies)
Discussion started by: tomjones
3 Replies

5. Shell Programming and Scripting

count average

Hi Friends, Can any one help me with count average of student marks in this file (i can not change structure of the input file): input file: 1:John Smith:2 3 4 5 2:Mark Anderson:3 2 3:Susan Waterman:2 4 2 (numbers of marks are different) output: Name:John Smith ID#: 1 Avg. mark:... (6 Replies)
Discussion started by: mleplawy
6 Replies

6. Solaris

changing time zone from ist to bst

Hi, Can anybody tell me how to change time zone from ist to bst, What changes should be done in /etc/TIMEZONE file. wheather it is possible to change timezone without rebooting the server. Regards Manoj (1 Reply)
Discussion started by: manoj.solaris
1 Replies

7. Shell Programming and Scripting

Perl- Finding average "frequency" of occurrence of duplicate lines

Hello, I am working with a perl script that tries to find the average "frequency" in which lines are duplicated. So far I've only managed to find the way to count how many times the lines are repeated, the code is as follows: perl -ae' my $filename= $ENV{'i'}; open (FILE, "$filename") or... (10 Replies)
Discussion started by: acsg
10 Replies

8. Shell Programming and Scripting

shell script for finding average runtime of other script

so I've made a shell script that downloads 6 files in succession from a given url, then deletes them. Now I want to time the script, and the average time it uses by running it ~100 times. My problem is tho, how do I store the time it takes for each run through of the script? I know time writes to... (3 Replies)
Discussion started by: navlelo
3 Replies

9. Shell Programming and Scripting

Finding minimum maximum and average

I am trying to find the minimum maximum and average from one file which has values Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from... (5 Replies)
Discussion started by: aroragaurav.84
5 Replies

10. Shell Programming and Scripting

Finding an average

Basically, I need to find average of numbers which are given like: sh average file1 file (in files can be more than one number) ->10 sh average 5 7 ->6 sh average /users/file ->5 echo 5 7 | sh average 6 So basically i wrote my code but it gives me error... I am pretty sure it has to work... (10 Replies)
Discussion started by: Manu1234567
10 Replies
getpriority(3C) 					   Standard C Library Functions 					   getpriority(3C)

NAME
getpriority, setpriority - get and set the nice value SYNOPSIS
#include <sys/resource.h> int getpriority(int which, id_t who); int setpriority(int which, id_t who, int value); DESCRIPTION
The getpriority() function obtains the nice value of a process, thread, or set of processes. The setpriority() function sets the nice value of a process, thread, or set of processes to value+NZERO, where NZERO is defined to be 20. Target entities are specified by the values of the which and who arguments. The which argument can be one of the following values: PRIO_PROCESS, PRIO_PGRP, PRIO_USER, PRIO_GROUP, PRIO_SESSION, PRIO_LWP, PRIO_TASK, PRIO_PROJECT, PRIO_ZONE, or PRIO_CONTRACT, indicating that the who argument is to be interpreted as a process ID, a process group ID, an effective user ID, an effective group ID, a session ID, a thread (lwp) ID, a task ID, a project ID, a zone ID, or a process contract ID, respectively. A 0 value for the who argument specifies the current process, process group, or user. A 0 value for the who argument is treated as valid group ID, session ID, thread (lwp) ID, task ID, project ID, zone ID, or process contract ID. A P_MYID value for the who argument can be used to specify the current group, session, thread, task, project, zone, or process contract, respectively. If a specified process is multi-threaded, the nice value set with setpriority() affects all threads in the process. If more than one process is specified, getpriority() returns NZERO less than the lowest nice value pertaining to any of the specified enti- ties, and setpriority() sets the nice values of all of the specified processes to value+NZERO. The default nice value is NZERO. Lower nice values cause more favorable scheduling. The range of valid nice values is 0 to NZERO*2-1. If value+NZERO is less than the system's lowest supported nice value, setpriority() sets the nice value to the lowest supported value. If value+NZERO is greater than the system's highest supported nice value, setpriority() sets the nice value to the highest supported value. Only a process with appropriate privileges can lower the nice value. Any process or thread using SCHED_FIFO or SCHED_RR is unaffected by a call to setpriority(). This is not considered an error. A process or thread that subsequently reverts to SCHED_OTHER will not have its priority affected by such a setpriority() call. The effect of changing the nice value varies depending on the scheduling policy in effect. Since getpriority() can return the value -1 on successful completion, it is necessary to set errno to 0 prior to a call to getpriority(). If getpriority() returns the value -1, then errno can be checked to see if an error occurred or if the value is a legitimate nice value. RETURN VALUES
Upon successful completion, getpriority() returns an integer in the range from -NZERO to NZERO-1. Otherwise, -1 is returned and errno is set to indicate the error. Upon successful completion, setpriority() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The getpriority() and setpriority() functions will fail if: ESRCH No process or thread could be located using the which and who argument values specified. EINVAL The value of the which argument was not recognized, or the value of the who argument is not a valid process ID, process group ID, user ID, group ID, session ID, thread (lwp) ID, task ID, project ID, or zone ID. In addition, setpriority() may fail if: EPERM A process was located, but neither the real nor effective user ID of the executing process match the effective user ID of the process whose nice value is being changed. EACCES A request was made to change the nice value to a lower numeric value and the current process does not have appropriate privi- leges. EXAMPLES
Example 1 Example using getpriority() The following example returns the current scheduling priority for the process ID returned by the call to getpid(2). #include <sys/resource.h> ... int which = PRIO_PROCESS; id_t pid; int ret; pid = getpid(); ret = getpriority(which, pid); Example 2 Example using setpriority() The following example sets the nice value for the current process to 0. #include <sys/resource.h> ... int which = PRIO_PROCESS; id_t pid; int value = -20; int ret; pid = getpid(); ret = setpriority(which, pid, value); USAGE
The getpriority() and setpriority() functions work with an offset nice value (value-NZERO). The nice value is in the range 0 to 2*NZERO-1, while the return value for getpriority() and the third parameter for setpriority() are in the range -NZERO to NZERO-1. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
nice(1), renice(1), sched_get_priority_max(3C), sched_setscheduler(3C), attributes(5), standards(5) SunOS 5.11 1 Apr 2008 getpriority(3C)
All times are GMT -4. The time now is 01:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy