<commit_before><!doctype html>
<html lang="en" class="no-js">

<?php require_once('partials/header.php'); ?> 

<body>
	
	<?php require_once('partials/brand.php'); ?> 

	<div class="ts-main-content">
		<?php require_once('partials/nav.php'); ?> 

		<div class="content-wrapper">
			<div class="container-fluid">
				<div class="row">
					<div class="col-md-12">
						<h2 class="page-title">Memory</h2>
					</div>
				</div>
				
				<?php 
					$memory = getMemory();
					$percetUsed = ($memory[2] / $memory[1]) * 100;
					$percetUsed = round($percetUsed, 2);
				?>
		
				<div class="panel panel-default">
					<div class="panel-heading">
						Memory usage 
						<select name="max" id="max" onChange="refreshCombo()">
							<option value="12">12</option>
							<option value="24">24</option>
							<option value="48">48</option>
							<option value="72">72</option>
						</select>
						hours
					</div>
					<div class="panel-body">
						<div class="row">
							<div class="col-md-12">
								<div class="progress">
									<div class="progress-bar progress-bar-warning" style="width: <?php echo $percetUsed; ?>%">Used</div>
									<div class="progress-bar progress-bar-success" style="width: <?php echo (100 - $percetUsed); ?>%">Free</div>
								</div>
							</div>
						</div>

						<div class="row">
							<div class="col-md-3">
								<ul>
									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Total:</strong> <?php echo $memory[1]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Used:</strong> <?php echo $memory[2]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Free:</strong> <?php echo $memory[3]; ?>Mb
                                        <?php if ($memory[3] < 50) { ?>
											<button type="button" class="btn btn-warning btn-xs" data-toggle="modal" data-target="#myModal">
												<i class="fa fa-bomb"></i>
											</button>
                                        <?php  } ?>
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Shared:</strong> <?php echo $memory[4]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Buffers:</strong> <?php echo $memory[5]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Cached:</strong> <?php echo $memory[6]; ?>Mb
									</li>
								</ul>
							</div>

							<!-- Modal -->
							<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
								<div class="modal-dialog" role="document">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">Memory Usage Process</h4>
										</div>
										<div class="modal-body">
											<table class="table table-bordered table-striped">
												<thead>
													<tr>
														<th>#</th>
														<th>PID</th>
														<th>% Mem</th>
														<th>Command</th>
													</tr>
												</thead>
												<tbody>
												<?php 
													$ml = getMemoryLeaks();
													
													for ($i = 1; $i <= count($ml) - 2; $i++) {
														echo "<tr>";
															$data = explode(" ", $ml[$i]);
					    									echo "<th scope=\"row\">" . $i . "</th>";
					    									echo "<td>" . $data[0] . "</td>";
					    									echo "<td>" . $data[1] . "</td>";
					    									echo "<td>" . $data[2] . "</td>";
														echo "</tr>";
													}
													
													?>
												</tbody>
											</table>

											
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
										</div>
									</div>
								</div>
							</div>

							<div class="col-md-9">
								<div class="chart">
									<canvas id="lineChart"></canvas>
								</div>
								<div id="legendDiv"></div>
							</div>

						</div>

					</div>
				</div>
			</div>
		</div>
	</div>

	<script>
		window.onload = function(){

			// Line chart from swirlData
			var ctx = document.getElementById("lineChart").getContext("2d");
			window.myLine = new Chart(ctx).Line(data, {
				responsive: true,
				scaleShowVerticalLines: false,
				multiTooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
			});<commit_msg>bugfixes<commit_after><!doctype html>
<html lang="en" class="no-js">

<?php require_once('partials/header.php'); ?> 

<body>
	
	<?php require_once('partials/brand.php'); ?> 

	<div class="ts-main-content">
		<?php require_once('partials/nav.php'); ?> 

		<div class="content-wrapper">
			<div class="container-fluid">
				<div class="row">
					<div class="col-md-12">
						<h2 class="page-title">Memory</h2>
					</div>
				</div>
				
				<?php 
					$memory = getMemory();
					$percetUsed = ($memory[2] / $memory[1]) * 100;
					$percetUsed = round($percetUsed, 2);
				?>
		
				<div class="panel panel-default">
					<div class="panel-heading">
						Memory usage 
						<select name="max" id="max" onChange="refreshCombo()">
							<option value="12">12</option>
							<option value="24">24</option>
							<option value="48">48</option>
							<option value="72">72</option>
						</select>
						hours
					</div>
					<div class="panel-body">
						<div class="row">
							<div class="col-md-12">
								<div class="progress">
									<div class="progress-bar progress-bar-warning" style="width: <?php echo $percetUsed; ?>%">Used</div>
									<div class="progress-bar progress-bar-success" style="width: <?php echo (100 - $percetUsed); ?>%">Free</div>
								</div>
							</div>
						</div>

						<div class="row">
							<div class="col-md-3">
								<ul>
									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Total:</strong> <?php echo $memory[1]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Used:</strong> <?php echo $memory[2]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Free:</strong> <?php echo $memory[3]; ?>Mb
                                        <?php if ($memory[3] < 50) { ?>
												<i class="fa fa-bomb"></i>
                                        <?php  } ?>
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Shared:</strong> <?php echo $memory[4]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Buffers:</strong> <?php echo $memory[5]; ?>Mb
									</li>

									<li>
										<i class="fa fa-angle-double-right"></i>
										<strong>Cached:</strong> <?php echo $memory[6]; ?>Mb
									</li>
								</ul>
							</div>

							<div class="col-md-9">
								<div class="chart">
									<canvas id="lineChart"></canvas>
								</div>
								<div id="legendDiv"></div>
							</div>
						</div>
					</div>
			</div>
			
			<div class="panel panel-default">
						<div class="panel-heading">
							Process 
						</div>
					<div class="panel-body">				
						<div class="row">
							<table class="table table-bordered table-striped">
								<thead>
									<tr>
										<th>#</th>
										<th>PID</th>
										<th>% Mem</th>
										<th>Command</th>
									</tr>
								</thead>
								<tbody>
								<?php 
									$ml = getMemoryLeaks();
									
									for ($i = 1; $i <= count($ml) - 2; $i++) {
										echo "<tr>";
											$data = explode(" ", $ml[$i]);
											echo "<th scope=\"row\">" . $i . "</th>";
											echo "<td>" . $data[0] . "</td>";
											echo "<td>" . $data[1] . "</td>";
											echo "<td>" . $data[2] . "</td>";
										echo "</tr>";
									}
									?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
		</div>
	</div>

	<script>
		window.onload = function(){

			// Line chart from swirlData
			var ctx = document.getElementById("lineChart").getContext("2d");
			window.myLine = new Chart(ctx).Line(data, {
				responsive: true,
				scaleShowVerticalLines: false,
				multiTooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
			});
{'fraction_non_alphanumeric': 0.20256289677874442, 'fraction_numerical': 0.011638843169527393, 'mean_word_length': 1.7441935483870967, 'pattern_counts': {'":': 0, '<': 315, '<?xml version=': 0, '>': 311, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4504525', 'n_tokens_mistral': 4505, 'n_tokens_neox': 2770, 'n_words': 558}