Changeset d694de in git for Singular/LIB


Ignore:
Timestamp:
Jun 18, 1999, 3:47:27 PM (25 years ago)
Author:
Gert-Martin Greuel <greuel@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
092430050dbf6ad127e0cf157b408a5b79bf6403
Parents:
96badc17f8c673319c806aa0ade02ab8ab717e4a
Message:
* extension of proc kmemory


git-svn-id: file:///usr/local/Singular/svn/trunk@3146 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    r96badc rd694de  
    1 // $Id: general.lib,v 1.11 1999-06-07 17:25:07 Singular Exp $
     1// $Id: general.lib,v 1.12 1999-06-18 13:47:27 greuel Exp $
    22//system("random",787422842);
    3 //GMG, last modified 30.9.98
    4 ///////////////////////////////////////////////////////////////////////////////
    5 
    6 version="$Id: general.lib,v 1.11 1999-06-07 17:25:07 Singular Exp $";
     3//GMG, last modified 18.6.99
     4///////////////////////////////////////////////////////////////////////////////
     5
     6version="$Id: general.lib,v 1.12 1999-06-18 13:47:27 greuel Exp $";
    77info="
    88LIBRARY:  general.lib   PROCEDURES OF GENERAL TYPE
     
    1313 factorial(n[,../..]);  n factorial (=n!) (type int), [type string/number]
    1414 fibonacci(n[,p]);      nth Fibonacci number [char p]
    15  kmemory();             int = active memory (kilobyte)
     15 kmemory([n]);          active [allocated] memory in kilobyte
    1616 killall();             kill all user-defined variables
    1717 number_e(n);           compute exp(1) up to n decimal digits
     
    230230///////////////////////////////////////////////////////////////////////////////
    231231
    232 proc kmemory ()
    233 "USAGE:   kmemory();
    234 RETURN:  memory used by active variables, of type int (in kilobyte)
     232proc kmemory (list #)
     233"USAGE:   kmemory([n]); n = int
     234RETURN:  memory in kilobyte of type int
     235         n=0: memory used by active variables (same as no parameters)
     236         n=1: total memory allocated by Singular
     237         n=2: difference between top and init memory adress (sbrk memory)
     238         n!=0,1,2: 0
     239DISPLAY: detailed information about allocated and used memory if n!=0,1,2
     240NOTE:    kmemory uses internal function 'memory' to compute kilobyte, and
     241         is the same as 'memory' for n!=0,1,2
    235242EXAMPLE: example kmemory; shows an example
    236243"
    237 {
    238   if ( voice==2 ) { "// memory used by active variables (kilobyte):"; }
    239    return ((memory(0)+1023)/1024);
     244{
     245   int n;
     246   if (size(#) != 0)
     247   {
     248     n=#[1];
     249   }
     250   
     251  if ( n==0)
     252  { dbprint(printlevel-voice+3,
     253    "// memory used, at the moment, by active variables (kilobyte):"); }
     254  if ( n==1 )
     255  { dbprint(printlevel-voice+3,
     256    "// total memory allocated, at the moment, by SINGULAR (kilobyte):"); }
     257   return ((memory(n)+1023)/1024);
    240258}
    241259example
    242260{ "EXAMPLE:"; echo = 2;
    243261   kmemory();
     262   kmemory(1);
    244263}
    245264///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.