Merge pull request #6190 from matrix-org/gsouquet/performance-tracking-markers

pull/21833/head
Germain 2021-06-17 10:27:33 +01:00 committed by GitHub
commit 782adbc41e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 8 deletions

View File

@ -37,17 +37,17 @@ export enum PerformanceEntryNames {
SWITCH_ROOM = "mx_SwithRoom",
JUMP_TO_ROOM = "mx_JumpToRoom",
JOIN_ROOM = "mx_JoinRoom",
CREATE_DM = "mx_CreateDM",
JOIN_ROOM = "mx_JoinRoom", // ✅
CREATE_DM = "mx_CreateDM", // ✅
PEEK_ROOM = "mx_PeekRoom",
/**
* User
*/
VERIFY_E2EE_USER = "mx_VerifyE2EEUser",
LOGIN = "mx_Login",
REGISTER = "mx_Register",
VERIFY_E2EE_USER = "mx_VerifyE2EEUser", // ✅
LOGIN = "mx_Login", // ✅
REGISTER = "mx_Register", // ✅
/**
* VoIP

View File

@ -20,9 +20,11 @@ const acceptInvite = require('../usecases/accept-invite');
const {receiveMessage} = require('../usecases/timeline');
const {createDm} = require('../usecases/create-room');
const {checkRoomSettings} = require('../usecases/room-settings');
const {startSasVerifcation, acceptSasVerification} = require('../usecases/verify');
const {startSasVerification, acceptSasVerification} = require('../usecases/verify');
const { setupSecureBackup } = require('../usecases/security');
const assert = require('assert');
const { measureStart, measureStop } = require('../util');
module.exports = async function e2eEncryptionScenarios(alice, bob) {
console.log(" creating an e2e encrypted DM and join through invite:");
@ -31,12 +33,14 @@ module.exports = async function e2eEncryptionScenarios(alice, bob) {
await acceptInvite(alice, 'bob');
// do sas verifcation
bob.log.step(`starts SAS verification with ${alice.username}`);
const bobSasPromise = startSasVerifcation(bob, alice.username);
await measureStart(bob, "mx_VerifyE2EEUser");
const bobSasPromise = startSasVerification(bob, alice.username);
const aliceSasPromise = acceptSasVerification(alice, bob.username);
// wait in parallel, so they don't deadlock on each other
// the logs get a bit messy here, but that's fine enough for debugging (hopefully)
const [bobSas, aliceSas] = await Promise.all([bobSasPromise, aliceSasPromise]);
assert.deepEqual(bobSas, aliceSas);
await measureStop(bob, "mx_VerifyE2EEUser");
bob.log.done(`done (match for ${bobSas.join(", ")})`);
const aliceMessage = "Guess what I just heard?!";
await sendMessage(alice, aliceMessage);

View File

@ -15,6 +15,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
const { measureStart, measureStop } = require('../util');
async function openRoomDirectory(session) {
const roomDirectoryButton = await session.query('.mx_LeftPanel_exploreButton');
await roomDirectoryButton.click();
@ -52,6 +54,8 @@ async function createRoom(session, roomName, encrypted=false) {
async function createDm(session, invitees) {
session.log.step(`creates DM with ${JSON.stringify(invitees)}`);
await measureStart(session, "mx_CreateDM");
const dmsSublist = await findSublist(session, "people");
const startChatButton = await dmsSublist.$(".mx_RoomSublist_auxButton");
await startChatButton.click();
@ -76,6 +80,8 @@ async function createDm(session, invitees) {
await session.query('.mx_MessageComposer');
session.log.done();
await measureStop(session, "mx_CreateDM");
}
module.exports = {openRoomDirectory, findSublist, createRoom, createDm};

View File

@ -16,9 +16,12 @@ limitations under the License.
*/
const {openRoomDirectory} = require('./create-room');
const { measureStart, measureStop } = require('../util');
module.exports = async function join(session, roomName) {
session.log.step(`joins room "${roomName}"`);
await measureStart(session, "mx_JoinRoom");
await openRoomDirectory(session);
const roomInput = await session.query('.mx_DirectorySearchBox input');
await session.replaceInputText(roomInput, roomName);
@ -26,5 +29,6 @@ module.exports = async function join(session, roomName) {
const joinFirstLink = await session.query('.mx_RoomDirectory_table .mx_RoomDirectory_join .mx_AccessibleButton');
await joinFirstLink.click();
await session.query('.mx_MessageComposer');
await measureStop(session, "mx_JoinRoom");
session.log.done();
};

View File

@ -74,7 +74,7 @@ async function doSasVerification(session) {
return sasCodes;
}
module.exports.startSasVerifcation = async function(session, name) {
module.exports.startSasVerification = async function(session, name) {
session.log.startGroup("starts verification");
await startVerification(session, name);

View File

@ -26,3 +26,15 @@ module.exports.range = function(start, amount, step = 1) {
module.exports.delay = function(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
};
module.exports.measureStart = function(session, name) {
return session.page.evaluate(_name => {
window.mxPerformanceMonitor.start(_name);
}, name);
};
module.exports.measureStop = function(session, name) {
return session.page.evaluate(_name => {
window.mxPerformanceMonitor.stop(_name);
}, name);
};

View File

@ -88,6 +88,10 @@ async function runTests() {
window.mxPerformanceMonitor.addPerformanceDataCallback({
entryNames: [
window.mxPerformanceEntryNames.REGISTER,
window.mxPerformanceEntryNames.LOGIN,
window.mxPerformanceEntryNames.JOIN_ROOM,
window.mxPerformanceEntryNames.CREATE_DM,
window.mxPerformanceEntryNames.VERIFY_E2EE_USER,
],
callback: (events) => {
measurements = JSON.stringify(events);