Skip to content

Instantly share code, notes, and snippets.

@charlie5
Created July 2, 2013 11:45
Show Gist options
  • Save charlie5/5908641 to your computer and use it in GitHub Desktop.
Save charlie5/5908641 to your computer and use it in GitHub Desktop.
with
Koparo.Database.User,
Ada.Text_IO;
procedure Launch_Rattler_Stress_Test
is
procedure Log (Message : in String) renames Ada.Text_IO.Put_Line;
begin
Koparo.Database.Rattlesnake_URL_Is ("dev.koparo.com:7080");
declare
task type Simulated_Kio;
task body Simulated_Kio
is
begin
declare
Authorisation_Token : constant String := Koparo.Database.User.Authenticate ("neil.koparo@aulace.com",
"koparo!");
Pro_ID : Integer;
begin
Pro_ID := Koparo.Database.User.Find_User ("neil.koparo@aulace.com",
Authorisation_Token ).ID;
Koparo.Database.User.Logout (Authorisation_Token);
exception
when Koparo.Database.Forbidden =>
Log ("Access to database is forbidden !");
end;
end Simulated_Kio;
All_Kios : array (1 .. 1000) of Simulated_Kio;
Done_Count : Natural;
Active_Count : Natural;
Prior_Active_Count : Natural := 0;
All_Done : Boolean;
begin
loop
All_Done := True;
Active_Count := 0;
Done_Count := 0;
for Each in All_Kios'Range
loop
if not All_Kios (Each)'Terminated then
All_Done := False;
Active_Count := Active_Count + 1;
else
Done_Count := Done_Count + 1;
end if;
end loop;
if Active_Count /= Prior_Active_Count
then
Log ("");
Log ("Active: " & Natural'Image (Active_Count));
Log ("Done: " & Natural'Image ( Done_Count));
Prior_Active_Count := Active_Count;
end if;
exit when All_Done;
-- delay 0.01;
end loop;
end;
end Launch_Rattler_Stress_Test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment