Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Console output, when finished -> write elapsed time #16

Closed
hmol opened this issue May 15, 2016 · 7 comments
Closed

In Console output, when finished -> write elapsed time #16

hmol opened this issue May 15, 2016 · 7 comments

Comments

@hmol
Copy link
Owner

hmol commented May 15, 2016

When program is finished running, write elapsed time to console output.

@ghost
Copy link

ghost commented Jun 4, 2016

Hi! A novice programmer here. I would like to work on this.

@hmol
Copy link
Owner Author

hmol commented Jun 15, 2016

hello @sourangshu24
This task could be a bit more complicated than I first thought.
Since the application is using asynch functions, you need to research how you can know when the program is finished running. Maybe we need to change some parts of the LinkCrawler.cs.

@ghost
Copy link

ghost commented Jun 16, 2016

Hi @hmol ! I was thinking more on the lines of modifying Program.cs to store the local system times ( for start and end times) before a call to linkCrawler.Start() is made and before Console.Read() is called respectively. I supppose even async calls will finish by the time control jumps back to Program.cs to call Console.Read(). Please correct me if I am wrong and if my approach is wrong.

@hmol
Copy link
Owner Author

hmol commented Jun 16, 2016

Yeah, you can clone my repo and test it if you want :)
Read about async here https://msdn.microsoft.com/en-us/library/mt674882.aspx
Thing is, all the method-calls that will fetch markup and find broken links will be async. So I suspect that the program will go to Console.Read() before it has finished the crawling.
Put Console.WriteLine("This is the end.") in line above Console.Read()to test.

@ghost
Copy link

ghost commented Jun 16, 2016

I tested it as you suggested, and you are right! It does show "This is the end" at the beginning. Going back to your earlier suggestion of changing the LinkCrawler.cs file itself, i think a Stopwatch object should do the trick if i include it before calling the async function. But I need to research how to know when an async function has stopped executing.

@loneshark99
Copy link

loneshark99 commented Jul 9, 2016

@hmol, I have sent a pull request for this
f4f3b35

Thanks,
Yash
sc

timstarbuck added a commit to timstarbuck/LinkCrawler that referenced this issue Jul 21, 2016
In Console output, when finished -> write elapsed time hmol#16
@tdwright
Copy link
Collaborator

Think I've got a solution to this. Don't want to tread on any toes though - is anyone else actively working on this?

@hmol hmol closed this as completed Oct 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants