Testergebnis wird angezeigt

This commit is contained in:
ja
2021-12-23 08:50:31 +01:00
parent c6ea8cbf9b
commit 31d62f79d9
5 changed files with 71 additions and 28 deletions

View File

@@ -128,9 +128,10 @@ Public Class TestPerformance
Dim sw1 As Stopwatch = New Stopwatch Dim sw1 As Stopwatch = New Stopwatch
Dim sw2 As Stopwatch = New Stopwatch Dim sw2 As Stopwatch = New Stopwatch
Dim finalhash As Byte() Dim finalhash As Byte()
For zahl As Integer = 0 To zahlint For zahl As Integer = 0 To zahlint
sw1.Start() sw1.Start()
hashsalts.Add(VERAG_VARIABLES.GenerateSalt(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 1), Math.Pow(2, 5)))) hashsalts.Add(VERAG_VARIABLES.GenerateSalt(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 7))))
arrzahl_iterats.Add(VERAG_VARIABLES.getiterationnumber) arrzahl_iterats.Add(VERAG_VARIABLES.getiterationnumber)
arrzahl.Add(zahlint) arrzahl.Add(zahlint)
sw1.Stop() sw1.Stop()
@@ -153,18 +154,11 @@ Public Class TestPerformance
arrzeitp3.Add(arrzeitp2.Item(zp1)) arrzeitp3.Add(arrzeitp2.Item(zp1))
End If End If
Next Next
For Each zp2 In arrzeitp2
If arrzeitp2(zp2) > arrzeitp1(zp2) Then
arrzeitp3.Add(arrzeitp2.Item(zp2))
Else
arrzeitp3.Add(arrzeitp1.Item(zp2))
End If
Next
For Each z3 In arrzeitp3 For Each z3 In arrzeitp3
finalarr.Add(hashbytes(z3)) finalarr.Add(hashbytes(z3))
Next Next
finalhash = finalarr.Item(0) finalhash = finalarr.Min
finalzeit = arrzeitp3.Item(0) finalzeit = arrzeitp3.Min
'Ausgabe 'Ausgabe
Return finalhash Return finalhash
End Function End Function

View File

@@ -79,9 +79,27 @@
</tr> </tr>
<tr><td> <tr><td>
<tr><td><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td></tr> <tr><td><asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /></td></tr>
<tr><td><asp:Button ID="btn_TesthashrateServer" runat="server" Font-Overline="false" BorderStyle="Dashed" ClientIDMode="AutoID" OnClick="btn_TesthashrateServer_ClickAsync" Text="Test hashrate of Server!" /></td></tr> <tr><td><input type="range" ID="sld_getbenchmarkheat" runat="server" AutoPostback="True" data-bs-toggle="tooltip" data-bs-placement="top" title="Disabled! Still under construction!" disabled="false" aria-disabled="false"/></td><td><asp:Label ID="lbl_valslider" runat="server">Wert der Stufe(1-100)</asp:Label></td></tr>
<tr><td><asp:Button ID="btn_TesthashrateServer" data-bs-toggle="tooltip" data-bs-placement="top" title="Disabled! Still under construction!" Enabled="true" runat="server" Font-Overline="false" BorderStyle="Dashed" ClientIDMode="AutoID" OnClick="btn_TesthashrateServer_ClickAsync" Text="Test hashrate of Server!" /></td></tr>
<tr><td><asp:Label runat="server" ID="lbl_Status" Text="Hier wird das Ergebnis des Benchmark Tests angezeigt!"></asp:Label></td></tr></table> <tr><td><asp:Label runat="server" ID="lbl_Status" Text="Hier wird das Ergebnis des Benchmark Tests angezeigt!"></asp:Label></td></tr></table>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<script>
var slider = document.getElementById('<%=sld_getbenchmarkheat.ClientID%>');
$('<%=lbl_valslider.ClientID%>').change(function () { slider.value = parseInt(this.value) });
</script>
<script>
$(document).ready(function () {
$('<%=btn_TesthashrateServer.ClientID%>').on('click', function (e) {
if ((e.target.id === 'ok') || (e.target.id === 'cancel')) {
return ();
} else {
// display message box
alert("Wirklich?")
}
})
});
</script>
</asp:Content> </asp:Content>

View File

@@ -2,16 +2,42 @@
Partial Class Customers_Default2 Partial Class Customers_Default2
Inherits System.Web.UI.Page Inherits System.Web.UI.Page
Dim nIterations As Integer = VERAG_VARIABLES.getiterationnumber Dim nIterations As Integer = VERAG_VARIABLES.getiterationnumber
Dim MemorySizelocal As Integer = -1
Dim MemorySizeProductionServ As Integer = -1
Dim randzahl As Integer = -1
Protected Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(ByVal sender As Object, e As EventArgs) Handles Me.Load
If Page.IsPostBack Then If Page.IsPostBack Then
Page.MaintainScrollPositionOnPostBack = True Page.MaintainScrollPositionOnPostBack = True
VERAG_VARIABLES.initerrorcount() VERAG_VARIABLES.initerrorcount()
If Integer.Parse(sld_getbenchmarkheat.Value) < 10 Then
MemorySizelocal = (((nIterations * 1) * 4.68 - ((nIterations * 2) * 1.23) / 4 * 1.5) / 1.05) + 0.75 * 254
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 2)) * 7.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 2)) * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 400
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 0), Math.Pow(2, 1)), Math.Pow(2, 2))
ElseIf Integer.Parse(sld_getbenchmarkheat.Value) > 10 And Integer.Parse(sld_getbenchmarkheat.Value) < 40 Then
MemorySizelocal = (((nIterations * 2) * 4.68 - ((nIterations * 2) * 1.23) / 4 * 1.5) / 1.05) + 0.75 * 290
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 2)) * 7.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 2)) * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 416
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 0), Math.Pow(2, 2)), Math.Pow(2, 4))
ElseIf Integer.Parse(sld_getbenchmarkheat.Value) > 40 And Integer.Parse(sld_getbenchmarkheat.Value) < 60 Then
MemorySizelocal = (((nIterations * 2.45) * 4.98 - ((nIterations * 1.15) * 1.23) / 4 * 1.5) / 1.05) + 0.95 * 290
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 7.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 0.56) / 1.85 * 2.28) / 7.28) + 1.024 * 416
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 0), Math.Pow(2, 4)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 3), Math.Pow(2, 4)))
ElseIf Integer.Parse(sld_getbenchmarkheat.Value) > 60 And Integer.Parse(sld_getbenchmarkheat.Value) < 80 Then
MemorySizelocal = (((nIterations * 2.45) * 4.98 - ((nIterations * 2) * 1.23) / 4 * 1.5) / 1.05) + 1 * 290
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 8.585 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 2.32)) * 0.56) / 1.85 * 2.28) / 7.28) + 1.024 * 416
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 5)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 5), Math.Pow(2, 7)))
ElseIf Integer.Parse(sld_getbenchmarkheat.Value) > 80 And Integer.Parse(sld_getbenchmarkheat.Value) < 100 Then
MemorySizelocal = (((nIterations * 2) * 4.98 - ((nIterations * 2) * 1.23) / 4 * 1.5) / 1.05) + 1 * 290
MemorySizeProductionServ = (((nIterations * VERAG_VARIABLES.RandomInteger(1, 3)) * 9.485 - ((nIterations * VERAG_VARIABLES.RandomInteger(1, 3)) * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 416
randzahl = VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 5), Math.Pow(2, 6)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 6), Math.Pow(2, 7)))
End If
Else Else
Page.MaintainScrollPositionOnPostBack = False Page.MaintainScrollPositionOnPostBack = False
VERAG_VARIABLES.initerrorcount() VERAG_VARIABLES.initerrorcount()
End If End If
End Sub End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Protected Sub Button1_Click(sender As Object, e As EventArgs)
If String.IsNullOrEmpty(TextBox1.Text) = False And String.IsNullOrEmpty(TextBox2.Text) = False Then If String.IsNullOrEmpty(TextBox1.Text) = False And String.IsNullOrEmpty(TextBox2.Text) = False Then
VERAG_VARIABLES.initerrorcount() VERAG_VARIABLES.initerrorcount()
@@ -38,24 +64,27 @@ Partial Class Customers_Default2
Protected Sub btn_TesthashrateServer_ClickAsync(sender As Object, e As EventArgs) Handles btn_TesthashrateServer.Click Protected Sub btn_TesthashrateServer_ClickAsync(sender As Object, e As EventArgs) Handles btn_TesthashrateServer.Click
Dim Boole As Boolean = New Boolean Dim Boole As Boolean = New Boolean
Dim ram As Double = Double.Parse(My.Computer.Info.TotalPhysicalMemory.ToString) Dim ram As Double = Double.Parse(My.Computer.Info.TotalPhysicalMemory.ToString)
Dim pwhashresult As Byte()
Dim MemorySizelocal = ((nIterations * 4.98 - (nIterations * 1.23) / 4 * 1.5) / 1.05) + 1 * 290
Dim MemorySizeProductionServ = ((nIterations * 8.485 - (nIterations * 0.56) / 1.85 * 2.28) / 8.28) + 1.024 * 416
If MemorySizelocal < ram And HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then If MemorySizelocal < ram And HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
Dim pwhashresult As Byte() = TestPerformance.TestHashrateServer(VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 0), Math.Pow(2, 3)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 4), Math.Pow(2, 6)))) pwhashresult = TestPerformance.TestHashrateServer(randzahl)
Boole = True Boole = True
ElseIf MemorySizeProductionServ < ram And Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then ElseIf MemorySizeProductionServ < ram And Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
Dim pwhashresult As Byte() = TestPerformance.TestHashrateServer(VERAG_VARIABLES.RandomInteger(VERAG_VARIABLES.RandomInteger(Math.Pow(2, 2), Math.Pow(2, 4)), VERAG_VARIABLES.RandomInteger(Math.Pow(2, 5), Math.Pow(2, 7)))) pwhashresult = TestPerformance.TestHashrateServer(randzahl)
Boole = True Boole = True
Else Else
Boole = False Boole = False
End If End If
If Boole = True Then If Boole = True AndAlso HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
lbl_Status.Text = "Der Test wurde erfolgreich bestanden!" lbl_Status.ForeColor = Drawing.Color.Green
lbl_Status.Text = "Der Test wurde erfolgreich bestanden! Der Salt lautet:" + Convert.ToBase64String(pwhashresult) + System.Environment.NewLine + "der Ram betrug:" + MemorySizelocal.ToString
ElseIf Boole = True AndAlso Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
lbl_Status.ForeColor = Drawing.Color.Green
lbl_Status.Text = "Der Test wurde erfolgreich bestanden! Der Hash lautet:" + Convert.ToBase64String(pwhashresult) + System.Environment.NewLine + "der Ram betrug:" + MemorySizeProductionServ.ToString
ElseIf Boole = False AndAlso HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then ElseIf Boole = False AndAlso HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
lbl_Status.ForeColor = Drawing.Color.Red
lbl_Status.Text = "Test fehlgeschlagen! Es fehlen mindestens " + MemorySizelocal - ram + "Bytes RAM!" lbl_Status.Text = "Test fehlgeschlagen! Es fehlen mindestens " + MemorySizelocal - ram + "Bytes RAM!"
ElseIf Boole = False AndAlso Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then ElseIf Boole = False AndAlso Not HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
lbl_Status.ForeColor = Drawing.Color.Red
lbl_Status.Text = "Test fehlgeschlagen! Es fehlen mindestens " + MemorySizeProductionServ - ram + "Bytes RAM!" lbl_Status.Text = "Test fehlgeschlagen! Es fehlen mindestens " + MemorySizeProductionServ - ram + "Bytes RAM!"
End If End If
End Sub End Sub

View File

@@ -310,12 +310,12 @@
} }
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function doPostBack(id,nat, strtemp) { function doPostBack(id) {
let Speditionslabel = document.getElementById("<%=lbl_sped_Placeholder.ClientID%>") let Speditionslabel = document.getElementById("<%=lbl_sped_Placeholder.ClientID%>")
let natplaceholder = document.getElementById("<%=lbl_Placeholder.ClientID%>") let natplaceholder = document.getElementById("<%=lbl_Placeholder.ClientID%>")
Speditionslabel.textContent = id.split(',')[0]; Speditionslabel.textContent = id.split(',')[0];
natplaceholder.textContent = nat; natplaceholder.textContent = id.split(',')[1];
const obj = JSON.parse(strtemp); const obj = JSON.parse(id.split(',')[2]);
for (let i = 0; i <= obj.length; i++) { for (let i = 0; i <= obj.length; i++) {
let SDL = obj[i].result; let SDL = obj[i].result;
@@ -326,8 +326,12 @@
Pagemethods.filltable2(<%=tbl_mainpage%>, SDL, Bez, Datguenstig, KartNr) Pagemethods.filltable2(<%=tbl_mainpage%>, SDL, Bez, Datguenstig, KartNr)
} }
} }
function doPostBack_M(id, strtemp) { function doPostBack_M(id) {
let obj = JSON.parse(strtemp) let Speditionslabel = document.getElementById("<%=lbl_sped_Placeholder.ClientID%>")
let natplaceholder = document.getElementById("<%=lbl_Placeholder.ClientID%>")
Speditionslabel.textContent = id.split(',')[0];
natplaceholder.textContent = id.split(',')[1];
const obj = JSON.parse(id.split(",")[2])
alert(obj.result) alert(obj.result)
for (let i = 0; i <= obj.length; i++) { for (let i = 0; i <= obj.length; i++) {
let SDL = obj[i].result; let SDL = obj[i].result;

View File

@@ -173,14 +173,12 @@ Partial Class LKWS
'MsgBox("Test3") 'MsgBox("Test3")
End Sub End Sub
Public Function ConvertToJSON(lst As List(Of String)) As String Public Function ConvertToJSON(lst As List(Of String)) As String
Dim jss1 As New JavaScriptSerializer() Dim jss1 As New JavaScriptSerializer()
Dim _myJSONstring As String = jss1.Serialize(lst) Dim _myJSONstring As String = jss1.Serialize(lst)
Return _myJSONstring Return _myJSONstring
End Function End Function
Private Sub initcells(thr1 As TableHeaderRow, th1 As TableHeaderCell, th2 As TableHeaderCell, th3 As TableHeaderCell, th4 As TableHeaderCell, th5 As TableHeaderCell, tr1 As TableRow, tc_KfzKennz As TableCell, tc_Nationalitaet As TableCell, tc_Verk As TableCell, tc_KZ_An As TableCell, tc_Vermerk As TableCell, countrows As Integer) Private Sub initcells(thr1 As TableHeaderRow, th1 As TableHeaderCell, th2 As TableHeaderCell, th3 As TableHeaderCell, th4 As TableHeaderCell, th5 As TableHeaderCell, tr1 As TableRow, tc_KfzKennz As TableCell, tc_Nationalitaet As TableCell, tc_Verk As TableCell, tc_KZ_An As TableCell, tc_Vermerk As TableCell, countrows As Integer)
'Dim res As Integer 'Dim res As Integer
thr1.BackColor = Drawing.Color.FromArgb(0, 4, 51, 129) thr1.BackColor = Drawing.Color.FromArgb(0, 4, 51, 129)