szha commented on a change in pull request #17376: [MXNET-1404] Implement 
storage tagging, the first half of the memory profiler
URL: https://github.com/apache/incubator-mxnet/pull/17376#discussion_r368549404
 
 

 ##########
 File path: include/mxnet/storage.h
 ##########
 @@ -26,15 +26,52 @@
 #define MXNET_STORAGE_H_
 
 #include <memory>
+#include <string>
 #include "./base.h"
 
 namespace mxnet {
 
+namespace {
+/// \brief Given a path, extract the filename.
+inline std::string __extract_fname(const std::string& path) {
+  std::size_t last_dir_pos = path.find_last_of("/\\");
+  if (last_dir_pos == std::string::npos) {
+    return path;
+  }
+  return path.substr(last_dir_pos + 1);
+}
+}  // namespace anonymous
+
+#if __GNUG__  // if compiled with GCC
+#define MXNET_STORAGE_DEFAULT_NAME_FARG(tag) \
+    std::string(tag) \
+    + "_" + __extract_fname(__FILE__) \
+    + "+" +  std::to_string(__LINE__) \
+    + "_" + __extract_fname(__builtin_FILE()) \
+    + "+" +  std::to_string(__builtin_LINE())
+#else  // !__GNUG__
+#define MXNET_STORAGE_DEFAULT_NAME_FARG(tag) \
+    std::string(tag) \
+    + "_" + __extract_fname(__FILE__) \
+    + "+" +  std::to_string(__LINE__)
+#endif  // __GNUG__
+#define MXNET_STORAGE_DEFAULT_PROFILER_SCOPE_CSTR  "<unk>:"
+
 /*!
  * \brief Storage manager across multiple devices.
  */
 class Storage {
  public:
+  enum class DataStruct {
 
 Review comment:
   this name seems too generic. It looks like this enum differentiates the type 
of data allocation. Shall we think of a more informative name in the line of 
that?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to