-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapplication_memory.html
More file actions
116 lines (99 loc) · 3.84 KB
/
application_memory.html
File metadata and controls
116 lines (99 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hyperlink Buttons</title>
<link rel="stylesheet" href="custompagestyle.css" type="text/css"/>
<style>
.positioned-textbox {
position: absolute;
top: 100px;
left: 20px;
width: 180px;
padding: 10px;
}
.read-only-textarea {
position: absolute;
top: 250px;
left: 20px;
background-color: #cecbcb;
border: 1px solid #ccc;
padding: 5px;
width: 1150px;
height: 170px;
resize: none;
}
</style>
</head>
<body>
<h1>Application memory test</h1>
<div class="container">
<input type="text" class="positioned-textbox" value="0" id="textbox" readonly>
</div>
<p></p>
<p></p>
<button type="button" class="nav-button" id="button" onclick="tiggerfunction()">
Fill Memory in MB
</button>
<!-- Go Back Link -->
<a href="#" onclick="history.back(); return false;" class="back-link" tabindex="0" id="backLink">
← Go Back to Previous Page
</a>
<textarea class="read-only-textarea" readonly>
Points to note:
* This page is for testing application memory threshold.
* For each button press, 25 MB of memory is allocated in container.
* Amount of total application memory allocated in the container can be checked by using following command in CPE SSH for each button press:
cat /sys/fs/cgroup/memory/lxc.slice/wpe-thunder@9.service/memory.max_usage_in_bytes
* When memory allocation exceeds 575 MB threshold of container, application will crash, exits from MVT and CS2400 notification is displayed.
* Please note that if navigated back to MVT page in between this test, ensure to exit from all Browser based apps and re-launch this test freshly.
</textarea>
<script>
window.onload = function() {
document.getElementById('button').focus();
};
document.body.style.backgroundColor = "#FFFFFF";
globalThis.permanentStorage = globalThis.permanentStorage || [];
var totalMem = 25;
var blockSize = 25;
function allocateMemory() {
const bytes = blockSize * 1024 * 1024;
const buffer = new Uint8Array(bytes);
buffer.fill(Math.random());
console.log("TotalMem allocated in MB : ", totalMem);
const inputElement = document.getElementById('textbox');
inputElement.value = totalMem;
totalMem = totalMem + blockSize;
return buffer;
}
function tiggerfunction() {
globalThis.permanentStorage.push(allocateMemory());
}
// Keyboard navigation functionalities
document.addEventListener('keydown', function(e) {
const focusedElement = document.activeElement;
let nextElement = null;
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
e.preventDefault();
}
if (e.key === 'ArrowDown') {
if (focusedElement.id === 'button') {
nextElement = document.getElementById('backLink');
} else if (focusedElement.id === 'backLink') {
nextElement = document.getElementById('button');
}
} else if (e.key === 'ArrowUp') {
if (focusedElement.id === 'button') {
nextElement = document.getElementById('backLink');
} else if (focusedElement.id === 'backLink') {
nextElement = document.getElementById('button');
}
}
if (nextElement) {
nextElement.focus();
}
});
</script>
</body>
</html>