GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - atecon/memusage: Compute the memory usage of a gretl object

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
memusage.sublime-project
memusage.sublime-project
 
 
memusage.sublime-workspace
memusage.sublime-workspace
 
 
run_tests.sh
run_tests.sh
 
 

Repository files navigation

memusage

This package computes the memory usage of a gretl object. The package comprises seven public functions for computing memory usage (in megabytes) of either a series, a list of series, a matrix, an array of matrices, a string, an array of strings and all items of a bundle comprising different data types.

Commented sample script

Install the package from gretl's package server

pkg install memusage    # download from package server

Compute memory usage in megabytes for gretl objects

clear
set verbose off
include memusage.gfn    # load functions into memory

# Define various objects differing in their data types
strings S = defarray("S1", "S2")
matrix m = ones(10^5, 32)
matrices M = defarray(ones(10^5, 32), ones(3,2))
string web_page = readfile("http://gretl.sourceforge.net/")
bundle b = defbundle("S", S, "m", m, "web_page", web_page, "LRM", LRM)
list L = LRM LRY IDE IBO

# Call the generic function consuming a bundle with various variables
scalar mem = memusage(b, TRUE)		# returns total memory of all bundle items
print mem

The printout is as follows:

Info: Size of strings : 1.52588e-05 MB.

Info: Size of matrix : 24.4141 MB.

Info: Size of series : 0.000419617 MB.

Info: Size of string : 0.133804 MB.

Info: Size of bundle b: 24.5483 MB.
24.548302

and scalar mem refers to the value 24.5483.

Public functions

Function: memusage()

Arguments:

  1. bundle, input bundle
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of all items of a bundle in megabytes.

Function: memusage_matrix()

Arguments:

  1. matrix, input matrix
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of a matrix in megabytes.

Function: memusage_matrices()

Arguments:

  1. matrices, input array of matrices
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of an array of matrices in megabytes.

Function: memusage_series()

Arguments:

  1. series, input series
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of a series in megabytes.

Function: memusage_list()

Arguments:

  1. list, list of series
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return: 'Computes the memory usage of a list of series in megabytes.


Function: memusage_string()

Arguments:

  1. string, input string
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of a string in megabytes. Note: If unicode formats is ASCII, the memory usage is one byte per character; if UTF-8 it depends, at least one byte but up to 4 per character. We will always assume one by per character.

Function: memusage_strings()

Arguments:

  1. strings, array of input strings
  2. bool, print value in megabytes

Output:

  • scalar, memory use in megabytes

Return:

  • Computes the memory usage of an array of strings in megabytes. Note: If unicode formats is ASCII, the memory usage is one byte per character; if UTF-8 it depends, at least one byte but up to 4 per character. We will always assume one by per character.

Changelog:

  • v1.0, June 2020:
    • initial release

About

Compute the memory usage of a gretl object

Topics

gretlhansl

Resources

Readme
Apache-2.0 license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.