
Module: ppl/ppl Branch: master Commit: 0d53ceac4d79dfb1d6ba9407c48154071481ad52 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=0d53ceac4d79d...
Author: Patricia Hill p.m.hill@leeds.ac.uk Date: Thu Feb 18 13:43:28 2010 +0000
Added total_memory_in_bytes() and external_memory_in_bytes() to MIP_Problem and PIP_Problem in the C interface.
---
interfaces/C/ppl_c_header.h | 28 ++++++++++++++++++++++++ interfaces/C/ppl_c_implementation_common.cc | 31 +++++++++++++++++++++++++++ interfaces/C/tests/pip_test.c | 4 ++- 3 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/interfaces/C/ppl_c_header.h b/interfaces/C/ppl_c_header.h index f21626b..7cce12c 100644 --- a/interfaces/C/ppl_c_header.h +++ b/interfaces/C/ppl_c_header.h @@ -2658,6 +2658,20 @@ int ppl_MIP_Problem_set_control_parameter PPL_PROTO((ppl_MIP_Problem_t mip, int value));
+/*! \relates ppl_MIP_Problem_tag \brief + Writes into \p *sz the size in bytes of the memory occupied by \p mip. +*/ +int +ppl_MIP_Problem_total_memory_in_bytes +PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz)); + +/*! \relates ppl_MIP_Problem_tag \brief + Writes into \p *sz the size in bytes of the memory managed by \p mip. +*/ +int +ppl_MIP_Problem_external_memory_in_bytes +PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz)); + /*@}*/ /* Querying/Setting Control Parameters */
@@ -2876,6 +2890,20 @@ int ppl_PIP_Problem_set_big_parameter_dimension PPL_PROTO((ppl_PIP_Problem_t pip, ppl_dimension_type d));
+/*! \relates ppl_PIP_Problem_tag \brief + Writes into \p *sz the size in bytes of the memory occupied by \p pip. +*/ +int +ppl_PIP_Problem_total_memory_in_bytes +PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz)); + +/*! \relates ppl_PIP_Problem_tag \brief + Writes into \p *sz the size in bytes of the memory managed by \p pip. +*/ +int +ppl_PIP_Problem_external_memory_in_bytes +PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz)); + /*@}*/ /* Querying/Setting Control Parameters */
diff --git a/interfaces/C/ppl_c_implementation_common.cc b/interfaces/C/ppl_c_implementation_common.cc index d6ad365..2d0598e 100644 --- a/interfaces/C/ppl_c_implementation_common.cc +++ b/interfaces/C/ppl_c_implementation_common.cc @@ -2115,6 +2115,22 @@ ppl_MIP_Problem_OK(ppl_const_MIP_Problem_t mip) try { CATCH_ALL
int +ppl_MIP_Problem_total_memory_in_bytes(ppl_const_MIP_Problem_t mip, + size_t* sz) try { + *sz = to_const(mip)->total_memory_in_bytes(); + return 0; +} +CATCH_ALL + +int +ppl_MIP_Problem_external_memory_in_bytes(ppl_const_MIP_Problem_t mip, + size_t* sz) try { + *sz = to_const(mip)->external_memory_in_bytes(); + return 0; +} +CATCH_ALL + +int ppl_new_PIP_Problem_from_space_dimension(ppl_PIP_Problem_t* ppip, ppl_dimension_type d) try { *ppip = to_nonconst(new PIP_Problem(d)); @@ -2316,6 +2332,21 @@ ppl_PIP_Problem_set_big_parameter_dimension(ppl_PIP_Problem_t pip, } CATCH_ALL
+int +ppl_PIP_Problem_total_memory_in_bytes(ppl_const_PIP_Problem_t pip, + size_t* sz) try { + *sz = to_const(pip)->total_memory_in_bytes(); + return 0; +} +CATCH_ALL + +int +ppl_PIP_Problem_external_memory_in_bytes(ppl_const_PIP_Problem_t pip, + size_t* sz) try { + *sz = to_const(pip)->external_memory_in_bytes(); + return 0; +} +CATCH_ALL
int ppl_PIP_Tree_Node_as_solution(ppl_const_PIP_Tree_Node_t spip_tree, diff --git a/interfaces/C/tests/pip_test.c b/interfaces/C/tests/pip_test.c index 42cd3a4..ff0f533 100644 --- a/interfaces/C/tests/pip_test.c +++ b/interfaces/C/tests/pip_test.c @@ -180,6 +180,7 @@ main(int argc, char **argv) { ppl_dimension_type i, j; mpz_t mpc; int ok; + size_t sz = 0;
static ppl_dimension_type parameter_dim[N_PARAMETERS];
@@ -237,8 +238,9 @@ main(int argc, char **argv) { ppl_delete_Coefficient(c); mpz_clear(mpc);
+ ppl_PIP_Problem_total_memory_in_bytes(pip, &sz); + ppl_PIP_Problem_external_memory_in_bytes(pip, &sz); ok = (ppl_PIP_Problem_solve(pip) == PPL_PIP_PROBLEM_STATUS_OPTIMIZED); - if (ok) { ppl_dimension_type dim; ppl_const_PIP_Tree_Node_t solution;