-
Notifications
You must be signed in to change notification settings - Fork 55
/
constraint_profiling.cpp
49 lines (37 loc) · 1.32 KB
/
constraint_profiling.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/** @file
*****************************************************************************
Implementation of interfaces for profiling constraints.
See constraint_profiling.hpp .
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
*****************************************************************************/
#include <libff/common/profiling.hpp>
#include <libsnark/gadgetlib1/constraint_profiling.hpp>
namespace libsnark {
size_t constraint_profiling_indent = 0;
std::vector<constraint_profiling_entry> constraint_profiling_table;
size_t PRINT_CONSTRAINT_PROFILING()
{
size_t accounted = 0;
libff::print_indent();
printf("Constraint profiling:\n");
for (constraint_profiling_entry &ent : constraint_profiling_table)
{
if (ent.indent == 0)
{
accounted += ent.count;
}
libff::print_indent();
for (size_t i = 0; i < ent.indent; ++i)
{
printf(" ");
}
printf("* Number of constraints in [%s]: %zu\n", ent.annotation.c_str(), ent.count);
}
constraint_profiling_table.clear();
constraint_profiling_indent = 0;
return accounted;
}
}