Skip to content
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

add extra logging for file search perf #200205

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/vs/workbench/api/node/extHostSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ export class NativeExtHostSearch extends ExtHostSearch implements IDisposable {
override $provideFileSearchResults(handle: number, session: number, rawQuery: IRawFileQuery, token: vscode.CancellationToken): Promise<ISearchCompleteStats> {
const query = reviveQuery(rawQuery);
if (handle === this._internalFileSearchHandle) {
return this.doInternalFileSearch(handle, session, query, token);
const start = Date.now();
return this.doInternalFileSearch(handle, session, query, token).then(result => {
const elapsed = Date.now() - start;
this._logService.debug(`Ext host file search time: ${elapsed}ms`);
return result;
});
}

return super.$provideFileSearchResults(handle, session, rawQuery, token);
Expand Down
2 changes: 2 additions & 0 deletions src/vs/workbench/services/search/node/rawSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ export class SearchService implements IRawSearchService {
}

if (error) {
progressCallback({ message: 'Search finished. Error: ' + error.message });
e(error);
} else {
progressCallback({ message: 'Search finished. Stats: ' + JSON.stringify(complete.stats) });
c(complete);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ flakySuite('RawSearchService', () => {

let results = 0;
const cb: (p: ISerializedSearchProgressItem) => void = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (!Array.isArray(value)) {
assert.deepStrictEqual(value, match);
results++;
Expand All @@ -117,6 +120,9 @@ flakySuite('RawSearchService', () => {

const results: number[] = [];
const cb: (p: ISerializedSearchProgressItem) => void = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (Array.isArray(value)) {
value.forEach(m => {
assert.deepStrictEqual(m, match);
Expand Down Expand Up @@ -227,6 +233,9 @@ flakySuite('RawSearchService', () => {

const results: any[] = [];
const cb: IProgressCallback = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
Expand All @@ -252,6 +261,9 @@ flakySuite('RawSearchService', () => {

const results: number[] = [];
const cb: IProgressCallback = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (Array.isArray(value)) {
value.forEach(m => {
assert.deepStrictEqual(m, match);
Expand Down Expand Up @@ -285,6 +297,9 @@ flakySuite('RawSearchService', () => {

const results: any[] = [];
const cb: IProgressCallback = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
Expand Down Expand Up @@ -331,6 +346,9 @@ flakySuite('RawSearchService', () => {
});
const results: any[] = [];
const cb: IProgressCallback = value => {
if (!!(<IProgressMessage>value).message) {
return;
}
if (Array.isArray(value)) {
results.push(...value.map(v => v.path));
} else {
Expand Down