Skip to content

DO NOT MERGE YET: Rdar 30961871 metrics #8178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Mar 18, 2017

This set of changes augments ParseableOutput with a bit of cheap metrics-reporting machinery,
eventually destined for some form of telemetry Xcode-side (work there is still TBD, so don't merge
yet!)

The metrics come in two forms: a general rusage (user/sys/rss) dictionary reported for each
subprocess the driver runs, and a final set of counters representing jobs run and dependency
types that caused them (along with a cumulative rusage for the whole child process tree).

Feedback welcome. I expect this isn't entirely right but I tried a few other arrangements and this
seems like the least-intrusive way of getting a small set of lightweight cost signals out of compilers
in the field.

rdar://30961871

@graydon graydon requested review from jrose-apple and ddunbar March 18, 2017 00:58
@ddunbar
Copy link
Contributor

ddunbar commented Mar 18, 2017

This looks awesome to me, I think it has all the things I want!

Can we get an update to:
https://github.com/apple/swift/blob/master/docs/DriverParseableOutput.rst
showing an example of the format and a description of what the key fields mean as well?

static llvm::Optional<ResourceStats> OwnResourceStats();

// \brief Get the cumulative resources used by all children.
static llvm::Optional<ResourceStats> ChildResourceStats();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Method names should have lowerCamelCase.

TaskQueue::ChildResourceStats()
{
return Optional<ResourceStats>();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to update the Finished callback in the default TaskQueue implementation.

///
/// \returns a TaskFinishedResponse indicating whether or not execution
/// should proceed
typedef std::function<TaskFinishedResponse(ProcessId Pid, StringRef ErrorMsg,
StringRef Output, StringRef Errors,
void *Context, Optional<int> Signal)>
void *Context, Optional<int> Signal,
llvm::Optional<ResourceStats> Resources)>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: No "llvm::" needed.

struct ScalarTraits<llvm::sys::TimePoint<>> {
static void output(const llvm::sys::TimePoint<> &value, llvm::raw_ostream &os) {
using namespace std::chrono;
os << duration_cast<microseconds>(value.time_since_epoch()).count();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time_since_epoch isn't necessarily the same on all systems. We should probably pick our own epoch.

void markTransitive(SmallVectorImpl<const void *> &visited,
const void *node, MarkTracerImpl *tracer = nullptr);
const void *node,
CompilationCounters &counters,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this inside MarkTracer instead? Right now DependencyGraphImpl is still pretty generic and I like that we'd be able to break it out for some other purpose if we had to.

void
DependencyGraphImpl::countMarking(CompilationCounters &counters,
DependencyMaskTy kinds, bool isCascading) {
if (isCascading) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data is measuring "dependency edges actually traversed during a rebuild", right? Is that the right thing to be measuring? (As opposed to "total kinds of dependency edges", or "max fan-out from one changed file, regardless of edges taken to get there".)

@graydon
Copy link
Contributor Author

graydon commented Apr 1, 2017

Closing this out in favour of #8477

@graydon graydon closed this Apr 1, 2017
@graydon graydon deleted the rdar-30961871-metrics branch September 13, 2017 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants