mirror of
https://github.com/Z3Prover/z3
synced 2025-08-26 13:06:05 +00:00
sketch ArrayValue, add statistics
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
bf14aeb1bd
commit
80506dfdfa
4 changed files with 81 additions and 104 deletions
|
@ -23,6 +23,9 @@ using System.Diagnostics;
|
|||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
|
||||
using Z3_context = System.IntPtr;
|
||||
using Z3_stats = System.IntPtr;
|
||||
/// <summary>
|
||||
/// Objects of this class track statistical information about solvers.
|
||||
/// </summary>
|
||||
|
@ -123,25 +126,29 @@ namespace Microsoft.Z3
|
|||
{
|
||||
get
|
||||
{
|
||||
|
||||
uint n = Size;
|
||||
Entry[] res = new Entry[n];
|
||||
for (uint i = 0; i < n; i++)
|
||||
{
|
||||
Entry e;
|
||||
string k = Native.Z3_stats_get_key(Context.nCtx, NativeObject, i);
|
||||
if (Native.Z3_stats_is_uint(Context.nCtx, NativeObject, i) != 0)
|
||||
e = new Entry(k, Native.Z3_stats_get_uint_value(Context.nCtx, NativeObject, i));
|
||||
else if (Native.Z3_stats_is_double(Context.nCtx, NativeObject, i) != 0)
|
||||
e = new Entry(k, Native.Z3_stats_get_double_value(Context.nCtx, NativeObject, i));
|
||||
else
|
||||
throw new Z3Exception("Unknown data entry value");
|
||||
res[i] = e;
|
||||
}
|
||||
return res;
|
||||
return NativeEntries(Context.nCtx, NativeObject);
|
||||
}
|
||||
}
|
||||
|
||||
internal static Entry[] NativeEntries(Z3_context ctx, Z3_stats stats)
|
||||
{
|
||||
uint n = Native.Z3_stats_size(ctx, stats);
|
||||
Entry[] res = new Entry[n];
|
||||
for (uint i = 0; i < n; i++)
|
||||
{
|
||||
Entry e;
|
||||
string k = Native.Z3_stats_get_key(ctx, stats, i);
|
||||
if (Native.Z3_stats_is_uint(ctx, stats, i) != 0)
|
||||
e = new Entry(k, Native.Z3_stats_get_uint_value(ctx, stats, i));
|
||||
else if (Native.Z3_stats_is_double(ctx, stats, i) != 0)
|
||||
e = new Entry(k, Native.Z3_stats_get_double_value(ctx, stats, i));
|
||||
else
|
||||
throw new Z3Exception("Unknown data entry value");
|
||||
res[i] = e;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The statistical counters.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue