<commit_before>-module(client).
-export([start/2]).

start(ServerAddress, Number) -> logger:create(lists:concat([node(), ".log"])), start_n(ServerAddress, Number).

start_n(ServerAddress, 1) -> spawn_client(ServerAddress);
start_n(ServerAddress, Number) -> spawn_client(ServerAddress), start_n(ServerAddress, Number - 1).

spawn_client(ServerAddress) -> io:format("Spawne client...\n"), spawn(reader_client, setup, [ServerAddress]).
<commit_msg>Add function to start number of clients defined by the config<commit_after>-module(client).

-export([startClients/0, startClient/1]).

loadConfig() ->
  {ok, Config} = file:consult("./config/client.cfg"),
  Config.

startClient(Lifetime) ->
  ok.

do_times(Times, Fn, Arg) -> do_times(Times, Fn, Arg, []).

do_times(0, _Fn, _Arg, Results) -> Results;
do_times(Times, Fn, Arg, Results) ->
  NewResults = Results ++ [Fn(Arg)],
  NewTimes = Times - 1,
  do_times(NewTimes, Fn, Arg, NewResults).

startClients() ->
  Config = loadConfig(),
  {ok, Lifetime} = werkzeug:get_config_value(lifetime, Config),
  {ok, Clients} = werkzeug:get_config_value(clients, Config),
  do_times(Clients, fun client:startClient/1, Lifetime).
{'fraction_non_alphanumeric': 0.17096219931271478, 'fraction_numerical': 0.006872852233676976, 'mean_word_length': 5.734104046242774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '779073', 'n_tokens_mistral': 408, 'n_tokens_neox': 400, 'n_words': 83}