Commit c2bc7681 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* src/misc/memusage.cc, src/misc/memusage.hh: New files.

* src/misc/Makefile.am: Add them.
* src/tgbaalgos/gtec/gtec.cc,
src/tgbaalgos/gtec/gtec.hh: Add a "vmsize" statistic.
parent 9e97543e
2006-07-18 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/misc/memusage.cc, src/misc/memusage.hh: New files.
* src/misc/Makefile.am: Add them.
* src/tgbaalgos/gtec/gtec.cc,
src/tgbaalgos/gtec/gtec.hh: Add a "vmsize" statistic.
2006-07-14 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/tgba/bdddict.cc, src/tgba/bdddict.hh (free_annonymous_list_of):
......
## Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
## Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
## dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
## et Marie Curie.
##
......@@ -34,6 +34,7 @@ misc_HEADERS = \
hashfunc.hh \
ltstr.hh \
minato.hh \
memusage.hh \
modgray.hh \
optionmap.hh \
random.hh \
......@@ -46,6 +47,7 @@ libmisc_la_SOURCES = \
bddalloc.cc \
escape.cc \
freelist.cc \
memusage.cc \
minato.cc \
modgray.cc \
optionmap.cc \
......
// Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include "memusage.hh"
#include <sys/time.h>
#include <sys/resource.h>
#include <cstdio>
namespace spot
{
int
memusage()
{
int size;
FILE* file = fopen("/proc/self/statm", "r");
if (!file)
return -1;
int res = fscanf(file, "%d", &size);
(void) fclose(file);
if (res != 1)
return -1;
return size;
}
}
// Copyright (C) 2006 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#ifndef SPOT_MISC_MEMUSAGE_HH
# define SPOT_MISC_MEMUSAGE_HH
namespace spot
{
/// \brief Total number of pages in use by the program.
///
/// \return The total number of pages in use by the program if known.
/// -1 otherwise.
int memusage();
}
#endif // SPOT_MISC_MEMUSAGE_HH
......@@ -21,6 +21,7 @@
#include "gtec.hh"
#include "ce.hh"
#include "misc/memusage.hh"
namespace spot
{
......@@ -40,6 +41,9 @@ namespace spot
stats["removed components"] =
static_cast<spot::unsigned_statistics::unsigned_fun>
(&couvreur99_check::get_removed_components);
stats["vmsize"] =
static_cast<spot::unsigned_statistics::unsigned_fun>
(&couvreur99_check::get_vmsize);
}
couvreur99_check::~couvreur99_check()
......@@ -53,6 +57,15 @@ namespace spot
return removed_components;
}
unsigned
couvreur99_check::get_vmsize() const
{
int size = memusage();
if (size > 0)
return size;
return 0;
}
void
couvreur99_check::remove_component(const state* from)
{
......
......@@ -183,6 +183,7 @@ namespace spot
/// Number of dead SCC removed by the algorithm.
unsigned removed_components;
unsigned get_removed_components() const;
unsigned get_vmsize() const;
};
/// \brief A version of spot::couvreur99_check that tries to visit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment