about summary refs log blame commit diff
path: root/third_party/nix/src/libexpr/function-trace.cc
blob: b1b856965c2a8fe6868a464c6649cfccb7a17999 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                    
 
                         


               


                                                                               
                                                                        


                                         

                                                                               
                                                                       

 
                   
#include "libexpr/function-trace.hh"

#include <glog/logging.h>

namespace nix {

FunctionCallTrace::FunctionCallTrace(const Pos& pos) : pos(pos) {
  auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
  auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
  LOG(INFO) << "function-trace entered " << pos << " at " << ns.count();
}

FunctionCallTrace::~FunctionCallTrace() {
  auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
  auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
  LOG(INFO) << "function-trace exited " << pos << " at " << ns.count();
}

}  // namespace nix