Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
sternj committed Dec 3, 2024
1 parent 11c042e commit a2a9691
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/include/traceconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define __TRACECONFIG_H

#include <Python.h>

#include "printf.h"
#include <mutex>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -38,6 +38,7 @@ class TraceConfig {

auto res = _memoize.find(filename);
if (res != _memoize.end()) {
printf_("Memoize find %s %d\n", res->first.c_str(), res->second);
return res->second;
}
// Return false if filename contains paths corresponding to the native
Expand Down Expand Up @@ -66,6 +67,7 @@ class TraceConfig {
// strstr(filename, "site-packages") != nullptr ||
(strstr(filename, "<") &&
(strstr(filename, "<ipython") || strstr(filename, "<frozen")))) {
printf_("Detected inside one of the following: %s, %s, %s\n", python_lib.c_str(), scalene_lib.c_str(), anaconda_lib.c_str());
_memoize.insert(
std::pair<std::string, bool>(std::string(filename), false));
return false;
Expand All @@ -75,6 +77,7 @@ class TraceConfig {
if (owner != nullptr) {
for (char* traceable : items) {
if (strstr(filename, traceable)) {
printf_("Inside %s\n", traceable);
_memoize.insert(
std::pair<std::string, bool>(std::string(filename), true));
return true;
Expand All @@ -98,6 +101,7 @@ class TraceConfig {
bool result = false;
if (did_resolve_path) {
// True if we found this file in the original path.
printf("Resolved %s\n", resolved_path, scalene_base_path);
result = (strstr(resolved_path, scalene_base_path) != nullptr);
}

Expand Down

0 comments on commit a2a9691

Please sign in to comment.