Skip to content

Commit

Permalink
core/platform/profile_utils: Make Windows friendly.
Browse files Browse the repository at this point in the history
Some changes to assist in getting the bazel build for Windows working.
In particular:

- With tensorflow@8898e88
  core/platform/profile_utils/* needs to be included in Windows builds
  (Changes to tensorflow/core/BUILD in this change)
- Avoid building the AndroidArmV7ACpuUtilsHelper when not on Android.
Change: 148880242
  • Loading branch information
asimshankar authored and tensorflower-gardener committed Mar 1, 2017
1 parent 410cde0 commit e6637fd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
2 changes: 2 additions & 0 deletions tensorflow/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ cc_library(
"lib/**/*.cc",
"platform/*.h",
"platform/*.cc",
"platform/profile_utils/**/*.h",
"platform/profile_utils/**/*.cc",
],
exclude = [
"**/*test*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,5 @@ int64 AndroidArmV7ACpuUtilsHelper::ReadCpuFrequencyFile(
} // namespace profile_utils
} // namespace tensorflow

// defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21)
#else

// Dummy implementations to avoid link error.

namespace tensorflow {
namespace profile_utils {

void AndroidArmV7ACpuUtilsHelper::ResetClockCycle() {}
uint64 AndroidArmV7ACpuUtilsHelper::GetCurrentClockCycle() { return 1; }
void AndroidArmV7ACpuUtilsHelper::EnableClockCycleProfiling(bool) {}
int AndroidArmV7ACpuUtilsHelper::OpenPerfEvent(perf_event_attr *const,
const pid_t, const int,
const int, const unsigned long) {
return 0;
}
int64 AndroidArmV7ACpuUtilsHelper::CalculateCpuFrequency() { return 0; }

} // namespace profile_utils
} // namespace tensorflow

// defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21)
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ limitations under the License.
#include "tensorflow/core/platform/profile_utils/i_cpu_utils_helper.h"
#include "tensorflow/core/platform/types.h"

#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21)

struct perf_event_attr;

namespace tensorflow {
Expand Down Expand Up @@ -58,4 +60,7 @@ class AndroidArmV7ACpuUtilsHelper : public ICpuUtilsHelper {
} // profile_utils
} // tensorflow

// defined(__ANDROID__) && defined(__ARM_ARCH_7A__) && (__ANDROID_API__ >= 21)
#endif

#endif // TENSORFLOW_PLATFORM_PROFILEUTILS_ANDROID_ARMV7A_CPU_UTILS_HELPER_H__
2 changes: 2 additions & 0 deletions tensorflow/core/platform/profile_utils/clock_cycle_profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ limitations under the License.
#ifndef TENSORFLOW_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_
#define TENSORFLOW_PLATFORM_PROFILE_UTILS_CLOCK_CYCLE_PROFILER_H_

#include <algorithm>

#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/profile_utils/cpu_utils.h"
Expand Down

0 comments on commit e6637fd

Please sign in to comment.