Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
35f99246
Commit
35f99246
authored
Dec 27, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #657889: Implement posix.getloadavg.
parent
1e2dd6d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
5 deletions
+44
-5
Doc/lib/libos.tex
Doc/lib/libos.tex
+8
-0
Modules/posixmodule.c
Modules/posixmodule.c
+25
-0
configure
configure
+5
-3
configure.in
configure.in
+3
-2
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Doc/lib/libos.tex
View file @
35f99246
...
...
@@ -1431,6 +1431,14 @@ This can be used to determine the set of names known to the system.
Availability:
\UNIX
.
\end{datadesc}
\begin{funcdesc}
{
getloadavg
}{}
Return the number of processes in the system run queue averaged over
the last 1, 5, and 15 minutes or raises OSError if the load average
was unobtainable.
\versionadded
{
2.3
}
\end{funcdesc}
\begin{funcdesc}
{
sysconf
}{
name
}
Return integer-valued system configuration values.
If the configuration value specified by
\var
{
name
}
isn't defined,
...
...
Modules/posixmodule.c
View file @
35f99246
...
...
@@ -7135,6 +7135,28 @@ win32_startfile(PyObject *self, PyObject *args)
}
#endif
#ifdef HAVE_GETLOADAVG
PyDoc_STRVAR
(
posix_getloadavg__doc__
,
"getloadavg() -> (float, float, float)
\n\n
\
Return the number of processes in the system run queue averaged over
\n
\
the last 1, 5, and 15 minutes or raises OSError if the load average
\n
\
was unobtainable"
);
static
PyObject
*
posix_getloadavg
(
PyObject
*
self
,
PyObject
*
args
)
{
double
loadavg
[
3
];
if
(
!
PyArg_ParseTuple
(
args
,
":getloadavg"
))
return
NULL
;
if
(
getloadavg
(
loadavg
,
3
)
!=
3
)
{
PyErr_SetString
(
PyExc_OSError
,
"Load averages are unobtainable"
);
return
NULL
;
}
else
return
Py_BuildValue
(
"ddd"
,
loadavg
[
0
],
loadavg
[
1
],
loadavg
[
2
]);
}
#endif
static
PyMethodDef
posix_methods
[]
=
{
{
"access"
,
posix_access
,
METH_VARARGS
,
posix_access__doc__
},
#ifdef HAVE_TTYNAME
...
...
@@ -7408,6 +7430,9 @@ static PyMethodDef posix_methods[] = {
{
"abort"
,
posix_abort
,
METH_VARARGS
,
posix_abort__doc__
},
#ifdef MS_WINDOWS
{
"_getfullpathname"
,
posix__getfullpathname
,
METH_VARARGS
,
NULL
},
#endif
#ifdef HAVE_GETLOADAVG
{
"getloadavg"
,
posix_getloadavg
,
METH_VARARGS
,
posix_getloadavg__doc__
},
#endif
{
NULL
,
NULL
}
/* Sentinel */
};
...
...
configure
View file @
35f99246
#! /bin/sh
# From configure.in Revision: 1.37
7
.
# From configure.in Revision: 1.37
8
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3.
#
...
...
@@ -12007,11 +12007,13 @@ echo "${ECHO_T}MACHDEP_OBJS" >&6
for
ac_func
in
alarm
chown
clock confstr ctermid execv
\
fchdir flock fork fsync fdatasync fpathconf ftime ftruncate
\
gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd
\
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid
\
getpriority getpwent getwd
\
hstrerror inet_pton
kill
killpg lchown lstat
mkfifo mknod
mktime
\
mremap
nice
pathconf pause plock poll pthread_init
\
putenv
readlink
\
...
...
@@ -12019,7 +12021,7 @@ for ac_func in alarm chown clock confstr ctermid execv \
setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf
\
sigaction siginterrupt sigrelse strftime strptime
\
sysconf tcgetpgrp tcsetpgrp tempnam timegm
times
tmpfile tmpnam tmpnam_r
\
truncate uname
unsetenv utimes waitpid wcscoll _getpty
getpriority
truncate uname
unsetenv utimes waitpid wcscoll _getpty
do
as_ac_var
=
`
echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
echo
"
$as_me
:
$LINENO
: checking for
$ac_func
"
>
&5
...
...
configure.in
View file @
35f99246
...
...
@@ -1762,7 +1762,8 @@ AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
getpriority getpwent getwd \
hstrerror inet_pton kill killpg lchown lstat mkfifo mknod mktime \
mremap nice pathconf pause plock poll pthread_init \
putenv readlink \
...
...
@@ -1770,7 +1771,7 @@ AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
sigaction siginterrupt sigrelse strftime strptime \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
truncate uname unsetenv utimes waitpid wcscoll _getpty
getpriority
)
truncate uname unsetenv utimes waitpid wcscoll _getpty)
# For some functions, having a definition is not sufficient, since
# we want to take their address.
...
...
pyconfig.h.in
View file @
35f99246
...
...
@@ -159,6 +159,9 @@
/* Define this if you have the 6-arg version of gethostbyname_r(). */
#undef HAVE_GETHOSTBYNAME_R_6_ARG
/* Define to 1 if you have the `getloadavg' function. */
#undef HAVE_GETLOADAVG
/* Define to 1 if you have the `getlogin' function. */
#undef HAVE_GETLOGIN
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment