Skip to content

Commit

Permalink
add benchmarks docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlobu committed Feb 22, 2021
1 parent ce0177a commit 01fcde2
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ TODO: add how to get started with local SonarCube for Deskreen in details.

![sharng-session-init](./doc/init-sharing-session/deskreen-webrtc-screen-sharing-session-initiation-pavlobu-22012021.svg)

### Benchmarks:

[Benchmarks can be found here](./doc/benchmarks)

## Note on versioning:

- All versions git tags should start with `v` ex. `v1.0.0`
Expand Down
8 changes: 7 additions & 1 deletion app/client/src/components/PlayerControlPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ function PlayerControlPanel(props: PlayerControlPanelProps) {
</Button>
</Tooltip>
</Col>
<Col xs={12} md={6}>
<Col xs={12} md={1}>
<Row center="xs" style={{ height: '42px' }}>
<Text>FPS:&nbsp;</Text>
<p id="fps-show"></p>
</Row>
</Col>
<Col xs={12} md={5}>
<Row center="xs" style={{ height: '42px' }}>
<Row
center="xs"
Expand Down
68 changes: 68 additions & 0 deletions app/client/src/features/PeerConnection/peerConnectionHandlePeer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,63 @@ export function getSharingShourceType(peerConnection: PeerConnection) {
}
}

let lastFramesReceived = 0;
let lastCalculatedFPS = 0;
let lastCalculatedFPSTimestamp = 0;

function dumpStatsFramesPerSecondOnly(results: any) {
// framesReceived
let isFremsPerSecondSet;
let statsString = '';

results.forEach((res: any) => {
// statsString += '<h3>Report type=';
// statsString += res.type;
// statsString += '</h3>\n';
// statsString += `id ${res.id}<br>`;
// statsString += `time ${res.timestamp}<br>`;
Object.keys(res).forEach(k => {
if (k.includes('framesPerSecond') && k !== 'timestamp' && k !== 'type' && k !== 'id') {
// statsString += `${k}: ${res[k]}<br>`;
const fpsElement = document.getElementById('fps-show');
if (fpsElement) {
fpsElement.innerHTML = res[k];
}
isFremsPerSecondSet = true;
}

if (k.includes('framesReceived') && k !== 'timestamp' && k !== 'type' && k !== 'id') {
const currentTime = new Date().getTime();
const currentFramesReceived = parseInt(res[k], 10);

if (lastFramesReceived === 0) {
lastFramesReceived = currentFramesReceived;
lastCalculatedFPSTimestamp = currentTime;
return;
}
const framesDifference = currentFramesReceived - lastFramesReceived;
console.log('framesDifference', framesDifference);

const timeDifference = currentTime - lastCalculatedFPSTimestamp;
console.log('timeDifference', timeDifference);
const howManyTimesTimeDifferenceIsMorThanOneSecond = timeDifference / 1000;
console.log('howManyTimesTimeDifferenceIsMorThanOneSecond', howManyTimesTimeDifferenceIsMorThanOneSecond);

lastCalculatedFPS = Math.floor(framesDifference / howManyTimesTimeDifferenceIsMorThanOneSecond);
lastFramesReceived = currentFramesReceived;
lastCalculatedFPSTimestamp = currentTime;
}
});
});
if (!isFremsPerSecondSet) {
const fpsElement = document.getElementById('fps-show');
if (fpsElement) {
fpsElement.innerHTML = `~${lastCalculatedFPS}`;
}
}
// return statsString;
}

export default (peerConnection: PeerConnection) => {
if (peerConnection.peer === null) {
throw new PeerConnectionPeerIsNullError();
Expand Down Expand Up @@ -43,6 +100,17 @@ export default (peerConnection: PeerConnection) => {
});
}, 1000);

setInterval(() => {
// console.log('peerConnection framerate', peerConnection.peer);
// @ts-ignore
if (peerConnection.peer && peerConnection.peer._pc) {
// @ts-ignore
peerConnection.peer._pc.getStats(null).then((results: any) => {
dumpStatsFramesPerSecondOnly(results);
});
}
}, 2000);

peerConnection.videoAutoQualityOptimizer.startOptimizationLoop();

setTimeout(getSharingShourceType, 1000, peerConnection);
Expand Down
153 changes: 153 additions & 0 deletions doc/benchmarks/1-IPad-pro-2017-12.9-inch+Macbook-Pro-mid-2015.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# date Feb 22 2019, by @pavlobu

# Devices used in this test:

## MacBook Pro (Retina, 15-inch, Mid 2015)

Processor 2.5 GHz Quad-Core Intel Core i7

RAM 16 GB 1600 MHz DDR3

Graphics AMD Radeon R9 M370X 2 GB Intel Iris Pro 1536 MB

## IPad Pro 2017 12.9 inch

#### Deskreen version 1.0.7

## Performance Test 1

(nothing happnes on second screen that Ipad is viewing, no video playing or mouse movement):

setup:

Macbook mid 2015 + IPad Pro 2017
both connected to each other with USB 3.0 cable, internet sharing from macbook to IPad
sharing a full virtual display to IPad with 100% quality.
virtual display resolution (info from RDM software 1440x900)

Deskreen App running on macbook resources usage:
Data sent/sec: ~250 KB
RAM usage: 115 MB
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 200%

Descreen Viewer (Safai browser on IPad)
FPS average - 55

## Performance Test 2

same setup as in test 1, but playing a racing 3d game video in virtual screen on youtube, fullscreen on IPad

--- NO auto quality change performance adjustment feature
virtual display resolution (info from RDM software 1440x900)

Deskreen App running on macbook resources usage:
RAM becomes 300MB usage (+185MB than in test 1)
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 280% (+80% more than in test 1)
Data sent/sec ~ 2MB

Descreen Viewer (Safai browser on IPad)
framerate drops to ~10 FPS
then degrades to ~5FPS while playing racing game video. after playing video finished,
framerate comes back to 50 FPS but there is a gum-like mouse pointer movement after that.
There are situations where the framerate doesn't go up to 50 even when video is paused.
So need to restart screen sharing connection to continue normal usage for user.

## Performance Test 3

(nothing happnes on second screen that Ipad is viewing, no video playing or mouse movement):

setup:

virtual display resolution (info from RDM software 1440x900)
Macbook mid 2015 + IPad Pro 2017 ==
both connected to each other with WiFi 5gh (2 meters from wifi source)
sharing full virtual display to Ipad.
virtual display resolution (info from RDM software 1440x900)

Deskreen App running on macbook resources usage:
Data sent/sec: ~250 KB
RAM usage: 115 MB
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 200%

Descreen Viewer (Safai browser on IPad)
FPS average - 55

## Performance Test 4

same setup as in test 1, but playing a racing 3d game video on youtube, fullscreen on IPad

--- NO auto quality change performance adjustment feature
virtual display resolution (info from RDM software 1440x900)

Deskreen App running on macbook resources usage:
RAM becomes 300MB usage (+185MB than in test 1)
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 280% (+80% more than in test 1)
Data sent/sec ~ 2MB

Descreen Viewer (Safai browser on IPad)
framerate drops to ~15 FPS
then degrades to ~10 FPS while playing racing game video. after playing video finished,
framerate comes back to 50 FPS but there is a gum-like mouse pointer movement after that.
There are situations where the framerate doesn't go up to 50 even when video is paused.
So need to restart screen sharing connection to continue normal usage for user.

## Performance Test 5

same setup as in test 1, but playing a racing 3d game video on youtube, fullscreen on IPad

--- WITH auto quality change performance adjustment feature
virtual display resolution (info from RDM software 1440x900)

Deskreen App running on macbook resources usage:
RAM becomes 300MB usage (+185MB than in test 1)
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 280% (+80% more than in test 1)
Data sent/sec ~ 600 KB

Descreen Viewer (Safai browser on IPad)
framerate drops to ~ 18 MB per second
Overall performance is better when changing complex video stream with video quality adjustment.
the "gum" like mouse pointer movement still can appear after video playing session.

## Performance Test 6

same setup as in test 1, but playing a racing 3d game video on youtube, fullscreen on IPad

--- NO auto quality change performance adjustment feature
virtual display resolution (info from RDM software 1280x960)

Deskreen App running on macbook resources usage:
RAM becomes 300MB usage (+185MB than in test 1)
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 290%
Data sent/sec ~ 1.2MB

Descreen Viewer (Safai browser on IPad)
framerate drops to ~20 FPS
sometimes degrades to ~15 FPS while playing racing game video. after playing video finished,
framerate comes back to 55 FPS
no significant mouse pointer slow movement issues after that, but sometimes may appear and go avay after about 1 minute. If mouse pointer issue persists, need to restart connection to get rid of them

## Performance Test 7

same setup as in test 1, but playing a racing 3d game video on youtube, fullscreen on IPad

--- WITH auto quality change performance adjustment feature
virtual display resolution (info from RDM software 1280x960)

Deskreen App running on macbook resources usage:
RAM becomes 300MB usage (+185MB than in test 1)
CPU usage (macbook mid 2015 2.5 GHz Quad-Core Intel Core i7) ~ 200%
Data sent/sec ~ 900 KB

Descreen Viewer (Safai browser on IPad)
framerate drops to ~35 FPS
sometimes degrades to ~25 FPS while playing racing game video. after playing video finished,
framerate comes back to 55 FPS
no significant mouse pointer slow movement issues after that, but sometimes
may appear and go avay after about 1 minute. If mouse pointer issue persists,
need to restart connection to get rid of them

## Conclusion:

The macbook used in this example has a weak GPU. WebRTC has optimization algorithms that use GPU power for streaming videa with less latency.
Overall 1280x960 resolution of virtual display, with video auto quality change mode makes
Deskreen usable on that setup.

0 comments on commit 01fcde2

Please sign in to comment.