Files
dragonx/src/snark/libsnark/gadgetlib1/constraint_profiling.hpp
syd a55c186a74 Fix libsnark dependency build.
This changes libsnark to build in-place, instead of copying first to
a build directory. Previously, modifications made to the original
sources wouldn't get rebuilt without a 'make clean' because users
would be pointing to the copies.

This closes #2689.
2017-12-16 15:52:08 -05:00

43 lines
1.5 KiB
C++

/** @file
*****************************************************************************
Declaration of interfaces for profiling constraints.
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
*****************************************************************************/
#ifndef CONSTRAINT_PROFILING_HPP_
#define CONSTRAINT_PROFILING_HPP_
#include <cstddef>
#include <map>
#include <string>
#include <vector>
namespace libsnark {
extern size_t constraint_profiling_indent;
struct constraint_profiling_entry {
size_t indent;
std::string annotation;
size_t count;
};
extern std::vector<constraint_profiling_entry> constraint_profiling_table;
#define PROFILE_CONSTRAINTS(pb, annotation) \
for (size_t _num_constraints_before = pb.num_constraints(), _iter = (++constraint_profiling_indent, 0), _cp_pos = constraint_profiling_table.size(); \
_iter == 0; \
constraint_profiling_table.insert(constraint_profiling_table.begin() + _cp_pos, constraint_profiling_entry{--constraint_profiling_indent, annotation, pb.num_constraints() - _num_constraints_before}), \
_iter = 1)
size_t PRINT_CONSTRAINT_PROFILING(); // returns # of top level constraints
} // libsnark
#endif // CONSTRAINT_PROFILING_HPP_