pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.459 2003/01/12 16:00:14 mast Exp $ + || $Id: builtin_functions.c,v 1.460 2003/01/13 02:07:04 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.459 2003/01/12 16:00:14 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.460 2003/01/13 02:07:04 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:1745:    INT32 e;    for(e=0;e<a->size;e++)    copy_svalues_recursively_no_free(a->item+e, Pike_sp-args+1, 1, 0);    }    pop_n_elems(args);    push_array(a);   }      /*! @decl array(int) rusage()    *! -  *! Return resource usage. +  *! Return resource usage. An error is thrown if it isn't supported +  *! or if the system fails to return any information.    *!    *! @returns    *! Returns an array of ints describing how much resources the interpreter    *! process has used so far. This array will have at least 29 elements, of    *! which those values not available on this system will be zero.    *!    *! The elements are as follows:    *! @array    *! @elem int user_time    *! Time in milliseconds spent in user code.
pike.git/src/builtin_functions.c:1777:    *! way, which is the amount of unshared memory used for data.    *! @elem int isrss    *! Quote from GNU libc: An integral value expressed the same    *! way, which is the amount of unshared memory used for stack    *! space.    *! @elem int minor_page_faults    *! Minor page faults, i.e. TLB misses which required no disk I/O.    *! @elem int major_page_faults    *! Major page faults, i.e. paging with disk I/O required.    *! @elem int swaps -  *! Number of times the process was swapped out entirely. +  *! Number of times the process has been swapped out entirely.    *! @elem int block_input_op    *! Number of block input operations.    *! @elem int block_output_op    *! Number of block output operations.    *! @elem int messages_sent    *! Number of IPC messsages sent.    *! @elem int messages_received    *! Number of IPC messsages received.    *! @elem int signals_received    *! Number of signals received.
pike.git/src/builtin_functions.c:1834:    *! for more information.    *!    *! @note    *! All values may not be present on all systems.    *!    *! @seealso    *! @[time()], @[System.getrusage()]    */   void f_rusage(INT32 args)   { -  INT32 *rus,e; +  pike_rusage_t rus; +  size_t e;    struct array *v; -  +     pop_n_elems(args); -  rus=low_rusage(); -  if(!rus) -  PIKE_ERROR("rusage", "System rusage information not available.\n", Pike_sp, args); -  v=allocate_array_no_init(29,0); +  if(!pike_get_rusage (rus)) +  PIKE_ERROR("rusage", "System usage information not available.\n", Pike_sp, args); +  v=allocate_array_no_init(NELEM(rus),0);    -  for(e=0;e<29;e++) +  for(e=0;e<NELEM(rus);e++)    {    ITEM(v)[e].type=T_INT;    ITEM(v)[e].subtype=NUMBER_NUMBER;    ITEM(v)[e].u.integer=rus[e];    }       Pike_sp->u.array=v;    Pike_sp->type=T_ARRAY;    Pike_sp++;   }
pike.git/src/builtin_functions.c:2068:    *! This function returns the number of seconds since 1 Jan 1970.    *!    *! The second syntax does not call the system call @tt{time()@} as often,    *! but is only updated in the backed (when Pike code isn't running).    *!    *! The third syntax can be used to measure time more preciely than one    *! second. It return how many seconds has passed since @[t]. The precision    *! of this function varies from system to system.    *!    *! @seealso -  *! @[ctime()], @[localtime()], @[mktime()], @[gmtime()] +  *! @[ctime()], @[localtime()], @[mktime()], @[gmtime()], +  *! @[System.gettimeofday]    */   PMOD_EXPORT void f_time(INT32 args)   {    if(!args)    {    GETTIMEOFDAY(&current_time);    }else{    if(Pike_sp[-args].type == T_INT && Pike_sp[-args].u.integer > 1)    {    struct timeval tmp;