Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: c259799
  • Loading branch information
MediaPipe Team authored and jqtang committed Sep 9, 2019
1 parent 785d266 commit 423c21b
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 210 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build --copt='-Wno-unused-local-typedefs'
build --copt='-Wno-ignored-attributes'
# Temporarily set the incompatiblity flag for Bazel 0.27.0 and above
build --incompatible_disable_deprecated_attr_params=false
build --incompatible_depset_is_not_iterable=false

# Sets the default Apple platform to macOS.
build --apple_platform_type=macos
Expand Down
25 changes: 20 additions & 5 deletions mediapipe/docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ To build and run iOS apps:
```

Option 2. Follow Bazel's
[documentation](https://docs.bazel.build/versions/master/install-ubuntu.html)
[documentation](https://docs.bazel.build/versions/master/install-os-x.html#install-with-installer-mac-os-x)
to install any version of Bazel manually.
4. Install OpenCV and FFmpeg.
Expand Down Expand Up @@ -600,15 +600,30 @@ The steps below use Android Studio to build and install a MediaPipe example app.

5. Select `Configure` | `Plugins` install `Bazel`.

6. Select `Import Bazel Project`.
6. Select `Android Studio` | `Preferences` | `Bazel settings` and modify `Bazel binary location` to be the same as the output of `$ which bazel`.

7. Select `Import Bazel Project`.

* Select `Workspace`: `/path/to/mediapipe`.
* Select `Generate from BUILD file`: `/path/to/mediapipe/BUILD`.
* Select `Finish`.
* Modify `Project View` to be the following and select `Finish`.

```
directories:
# read project settings, e.g., .bazelrc
.
-mediapipe/objc
-mediapipe/examples/ios
targets:
//mediapipe/...:all
android_sdk_platform: android-29
```

7. Connect an Android device to the workstation.
8. Connect an Android device to the workstation.

8. Select `Run...` | `Edit Configurations...`.
9. Select `Run...` | `Edit Configurations...`.

* Enter Target Expression:
`//mediapipe/examples/android/src/java/com/google/mediapipe/apps/facedetectioncpu`
Expand Down
1 change: 1 addition & 0 deletions mediapipe/framework/profiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ cc_test(
"//mediapipe/calculators/core:flow_limiter_calculator",
"//mediapipe/calculators/core:immediate_mux_calculator",
"//mediapipe/calculators/core:round_robin_demux_calculator",
"//mediapipe/calculators/util:annotation_overlay_calculator",
"//mediapipe/framework:calculator_cc_proto",
"//mediapipe/framework:calculator_framework",
"//mediapipe/framework:calculator_profile_cc_proto",
Expand Down
12 changes: 10 additions & 2 deletions mediapipe/framework/profiler/graph_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ void GraphProfiler::Pause() {
}

void GraphProfiler::Resume() {
// is_profiling_ enables recording of performance stats.
// is_tracing_ enables recording of timing events.
// While the graph is running, these variables indicate
// IsProfilerEnabled and IsTracerEnabled.
is_profiling_ = IsProfilerEnabled(profiler_config_);
is_tracing_ = IsTracerEnabled(profiler_config_);
}
Expand Down Expand Up @@ -502,7 +506,7 @@ void GraphProfiler::AddProcessSample(
}

std::unique_ptr<GlProfilingHelper> GraphProfiler::CreateGlProfilingHelper() {
if (!IsProfilerEnabled(profiler_config_)) {
if (!IsTracerEnabled(profiler_config_)) {
return nullptr;
}
return absl::make_unique<mediapipe::GlProfilingHelper>(shared_from_this());
Expand Down Expand Up @@ -576,7 +580,6 @@ ::mediapipe::Status GraphProfiler::WriteProfile() {
LOG(INFO) << "trace_log_path: " << trace_log_path;
int log_interval_count = GetLogIntervalCount(profiler_config_);
int log_file_count = GetLogFileCount(profiler_config_);
++previous_log_index_;

// Record the GraphTrace events since the previous WriteProfile.
// The end_time is chosen to be trace_log_margin_usec in the past,
Expand All @@ -592,6 +595,10 @@ ::mediapipe::Status GraphProfiler::WriteProfile() {
tracer()->GetLog(previous_log_end_time_, end_time, trace);
}
previous_log_end_time_ = end_time;
// If there are no trace events, skip log writing.
if (is_tracing_ && trace->calculator_trace().empty()) {
return ::mediapipe::OkStatus();
}

// Record the latest CalculatorProfiles.
Status status;
Expand All @@ -603,6 +610,7 @@ ::mediapipe::Status GraphProfiler::WriteProfile() {
this->Reset();

// Record the CalculatorGraphConfig, once per log file.
++previous_log_index_;
bool is_new_file = (previous_log_index_ % log_interval_count == 0);
if (is_new_file) {
*profile.mutable_config() = validated_graph_->Config();
Expand Down
Loading

0 comments on commit 423c21b

Please sign in to comment.