If p1at.Text >= 0 Then
If p2at.Text >= 0 Then
If p3at.Text >= 0 Then
If p4at.Text >= 0 Then
If p5at.Text >= 0 Then
If p1at.Text <= p2at.Text And p1at.Text <= p3at.Text And p1at.Text <= p4at.Text And p1at.Text <= p5at.Text Then
If p1at.Text = 0 Then
p1ts = p1at.Text
p1tc = Val(p1ts) + Val(p1bt.Text)
ElseIf p1at.Text > 0 Then
ti1.Show()
idle1.Show()
ti1.Text = "0"
p1ts = p1at.Text
p1tc = p1ts + p1bt.Text
idle = idle + p1at.Text
End If
If p2at.Text <= p3at.Text And p2at.Text <= p4at.Text And p2at.Text <= p5at.Text Then
If p2at.Text <= p1tc Then
p2ts = p1tc
p2tc = p2ts + p2bt.Text
ElseIf p2at.Text > p1tc Then
ti2.Show()
idle2.Show()
p2ts = p2at.Text
ti2.Text = p2ts
p2tc = p2ts + p2bt.Text
idle = idle + (p2at.Text - p1tc)
End If
If p3at.Text <= p4at.Text And p3at.Text <= p5at.Text Then
If p3at.Text <= p2tc Then
p3ts = p2tc
p3tc = p3ts + p3bt.Text
ElseIf p3at.Text > p2tc Then
ti3.Show()
idle3.Show()
p3ts = p3at.Text
ti3.Text = p3ts
p3tc = p3ts + p3bt.Text
idle = idle + (p3at.Text - p2tc)
End If
If p4at.Text <= p5at.Text Then
If p4at.Text <= p3tc Then
p4ts = p3tc
p4tc = p4ts + p4bt.Text
If p5at.Text <= p4tc Then
p5ts = p4tc
p5tc = p5ts + p5bt.Text
ElseIf p5at.Text > p4tc Then
ti5.Show()
idle5.Show()
p5ts = p5at.Text
ti5.Text = p5ts
p5tc = p5ts + p5bt.Text
idle = idle + (p5at.Text - p4tc)
End If '// if p5at.text <= p4tc at else if p5at.text > p4tc
ElseIf p4at.Text > p3tc Then
ti4.Show()
idle4.Show()
p4ts = p4at.Text
ti4.Text = p4ts
p4tc = p4ts + p4bt.Text
idle = idle + (p4at.Text - p3tc)
If p5at.Text <= p4tc Then
p5ts = p4tc
p5tc = p5ts + p5bt.Text
ElseIf p5at.Text > p4tc Then
ti5.Show()
idle5.Show()
p5ts = p5at.Text
ti5.Text = p5ts
p5tc = p5tc + p5bt.Text
idle = idle + (p5at.Text - p4tc)
End If '//if p5at.text <= p4tc at else if p5at.text > p4tc
End If '//If p4at.Text <= p3tc at elseIf p4at.Text > p3tc
ElseIf p4at.Text > p5at.Text Then
If p5at.Text <= p3tc Then
p4ts = p3tc
p4tc = p4ts + p5bt.Text
ElseIf p5at.Text > p3tc Then
ti4.Show()
idle4.Show()
p4ts = p5at.Text
ti4.Text = p4ts
p4tc = p4ts + p5bt.Text
idle = idle + (p5at.Text - p3tc)
End If
End If '//if p4at.text <= p5at.text at else if p4at.text > p5at.text
================================================not yet done =================
ElseIf p4at.Text < p3at.Text And p4at.Text <= p5at.Text Then
ElseIf p5at.Text < p3at.Text And p5at.Text < p4at.Text Then
End If
ElseIf p3at.Text < p2at.Text And p3at.Text <= p4at.Text And p3at.Text <= p5at.Text Then
ElseIf p4at.Text < p2at.Text And p4at.Text < p3at.Text And p4at.Text <= p5at.Text Then
ElseIf p5at.Text < p2at.Text And p5at.Text < p3at.Text And p5at.Text < p4at.Text Then
End If
ElseIf p2at.Text <= p1at.Text And p3at.Text And p4at.Text And p5at.Text Then
ElseIf p3at.Text < p2at.Text And p1at.Text And p4at.Text And p5at.Text Then
ElseIf p4at.Text <= p1at.Text And p2at.Text And p3at.Text And p5at.Text Then
ElseIf p5at.Text <= p1at.Text And p2at.Text And p3at.Text And p4at.Text Then
End If
End If
End If
End If
End If
End If
'//formula
t1.Text = p1ts
t2.Text = p1tc
t3.Text = p2tc
t4.Text = p3tc
t5.Text = p4tc
t6.Text = p5tc
cpu.Text = ((p5tc - idle) / p5tc) * 100
ata.Text = ((p1tc - p1ts) + (p2tc - p2ts) + (p3tc - p3ts) + (p4ts - p4ts) + (p5tc - p5ts)) / 5
art.Text = ((p1ts - p1at.Text) + (p2ts - p2at.Text) + (p3ts - p3at.Text) + (p4ts - p4at.Text) + (p5ts - p5at.Text)) / 5
awt.Text = ((p1tc - p1bt.Text) + (p2tc - p2bt.Text) + (p3tc - p3bt.Text) + (p4tc - p4bt.Text) + (p5tc - p5bt.Text)) / 5
End Sub
there is a problem with the output. whenever i input double number like 11 12 etc. there is a conflict. but if i lower it to one digit. it gives the accurate answer.
example :
p1at = 1
p1bt = 1
p2at = 3 - there is an idle
p2bt = 5
p3at = 10 - there is an idle
p3bt = 5
p4at = 17 - there is an idle
p4bt = 2
p5at= 20 - there is an idle
p5bt = 2
output
cpu utilization - infinity
gantt chart = 0 1 2 0 0 0 0
art , ata, awt = negative something
even there is no idle it doesnt give the right answer unless i lower the number. there is something wrong in my code help me.