Question
Anzelem Sanyatwe · Jul 12, 2018

^%GSIZE Output showing only last page

How best can I capture %GSIZE all pages? Or parameters to use?

The output file is only showing the last page.

 

I used these options

Device: /usr/cache/mgr/gsizedoc.txt

Parameters? "WNS" =>

 

--------------------------

Page: 23                          GLOBAL SIZE                                                                            12 Jul 2018
                                                                                                                             3:56 PM
      Global        Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
      rINDEXSQL                           0      0 %         0
      rMAC                               12      0 %         0
      rMACSAVE                           16      0 %         0
      rMAP                               12      0 %         0
      rOBJ                              320      4 %         0
      tmpOut                            472      6 %         0
      waJobs                             56      1 %         0
      waLogArr                          476      6 %         0

 

---------------------------------------------------------------------------------------

%SYS>w $ZV

Cache for UNIX (Red Hat Enterprise Linux 5 for x86-64) 2010.2.3 (Build 702) Tue

Feb 15 2011 14:21:10 EST

%SYS>

0
0 1,006
Discussion (5)4
Log in or sign up to continue

This approach has an advantage over usign %GSIZE as the query in %SYS.GlobalQuery class has a parameter that can make quick estimations of the global sizes (simply counting # of blocks occupied by globals) rather than potentialy very slow exact global size determination always used by %GSIZE 

BTW. it is just 1 single line to be commented out.

On Win you could just swith on terminal logging.

For Linux, you could connect to your server using PuTTY or similar and enable logging.

Or make your personal copy %GSIZE => %zGSIZE and disable the artificial page breaks.
(an interesting programming exercise)

If you prefer to code global size calculation by yourself rather than amend ^%GSIZE, the feasible option is to call

set bSize=$$AllocatedSize^%GSIZE(global)

which returns size in bytes for a global mapped to the current namespace. It recognizes the database the global is mapped from, so you don't need to do it yourself. The only thing you need is a global list for the namespace, which can be fetched in several ways, e.g. using $Order(^$G(global)). It can be used on per database basis as well. Pros of this approach:
- speed, as it neither runs query nor instantiates %SYS.GlobalQuery objects;
- AFAIR, there was an error in global size calculation with %SYS.GlobalQuery::Size() query in old Caché versions, up to 2015.1;
- starting from 2015.1, it can be used with subglobals.

Cons:
- this $$-function is not documented;
- not sure if it existed in 2010.1.