#!/usr/bin/perl 
## @file memSizeShow
# @brief Shows total server memory size
# @details 
# @return $OK (0) - if total server memory size was defined successfully
# @return $ERROR (1) - some error happens 
# @author Kate Bazhanova
# @date May 2008
# @version 1.00 - Initial version
# @version 1.01 - Two colons were removed before shared functions and variables.

=pod

=head1 NAME

B<memSizeShow> Shows total server memory 

=head1 SYNOPSIS

B<memSizeShow> [B<--help>]

=head1 DESCRIPTION

B<memSizeShow> returns full size of the server memory

=head1 OPTIONS

=over 4

=item B<-help>

Print this help message and exit.

=back

=head1 EXAMPLES

$ B<memSizeShow>

Total server memory: 2047 MB

If cannot get total server memory:

$ B<memSizeShow>

Cannot get total server memory.

=head1 SEE ALSO

B<hdStat>

=cut


use lib "/opt/nortel/base/lib";

use strict;
use warnings;
use common_variables;
use common_functions;
use hwRecognition;

## @skipline
sub memSizeShow();
exit(memSizeShow());

###############################################################################
## @fn memSizeShow()
# @brief   Main function. 
# @details This function shows defined total server memory size if it was defined
#      \li otherwise it shows an error message.
# @return  $OK (0)    -  if total server memory was defined successfully
# @return  $ERROR (1) -  indicates an error condition.
# @author  Kate Bazhanova
# @date    May 2008

sub memSizeShow()
{
   my $mbytes = undef;
   my $retval = $OK;

   if (defined $ARGV[0] and $ARGV[0] =~ /help$/)
   {
      print_pod_usage();
      return $retval;
   }

   $mbytes = get_memory_stat();
   if ($mbytes)
   { 		 
      print("Total server memory: ",$mbytes," MB\n");
   }
   else
   {
      print("Cannot get total server memory.\n");
      $retval = $ERROR;
   } 
   return $retval;
} ## end sub memSizeShow()
