Skip to content

Commit

Permalink
[Releng] Better tracing to debug the marketplace-analyzer.
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Jun 27, 2021
1 parent 0948c8f commit 890ca85
Showing 1 changed file with 34 additions and 15 deletions.
Expand Up @@ -75,7 +75,9 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.equinox.p2.core.ProvisionException;
Expand Down Expand Up @@ -206,6 +208,11 @@ else if ("-skip".equals(option) || "-s".equals(option))

return null;
}
catch (Throwable throwable)
{
throwable.printStackTrace();
throw new RuntimeException(throwable);
}
finally
{
Job.getJobManager().join(org.eclipse.equinox.internal.p2.engine.ProfilePreferences.PROFILE_SAVE_JOB_FAMILY, new NullProgressMonitor());
Expand Down Expand Up @@ -261,9 +268,7 @@ public void perform(Map<String, URI> nodeURIs) throws Exception
}
}

ResourceMirror resourceMirror = new ResourceMirror(resourceSet, 50);
resourceMirror.perform(uris);
resourceMirror.dispose();
loadResources(uris);
}

System.out.println("Gathering " + uris.size() + " categories: " + (startListings - startCategories) / 1000);
Expand Down Expand Up @@ -331,18 +336,7 @@ public void perform(Map<String, URI> nodeURIs) throws Exception
}
}

ResourceMirror resourceMirror = new ResourceMirror(resourceSet, 50)
{
@Override
protected LoadJob createWorker(URI key, int workerID, boolean secondary)
{
System.out.println("Loading " + key);
return super.createWorker(key, workerID, secondary);
}
};

resourceMirror.perform(nodeQueryURIs);
resourceMirror.dispose();
loadResources(nodeQueryURIs);
}

long startRepositoryLoads = System.currentTimeMillis();
Expand Down Expand Up @@ -806,6 +800,31 @@ else if (size > 1 && normalizeP2Tasks)
System.out.println("Testing : " + (finishTesting - startTesting) / 1000 + " seconds");
}

private void loadResources(Set<URI> uris)
{
ResourceMirror resourceMirror = new ResourceMirror(resourceSet, 50)
{
@Override
protected LoadJob createWorker(final URI key, int workerID, boolean secondary)
{
LoadJob result = super.createWorker(key, workerID, secondary);
result.addJobChangeListener(new JobChangeAdapter()
{
@Override
public void running(IJobChangeEvent event)
{
System.out.println("Loading " + key);
super.running(event);
}
});
return result;
}
};

resourceMirror.perform(uris);
resourceMirror.dispose();
}

private void generateReport() throws Exception
{
Resource resource = resourceSet.getResource(getResolvedResourceURI(), true);
Expand Down

0 comments on commit 890ca85

Please sign in to comment.