wojteklu / watchdog Goto Github PK
View Code? Open in Web Editor NEWClass for logging excessive blocking on the main thread
License: MIT License
Class for logging excessive blocking on the main thread
License: MIT License
Hi!
Carthage support doesn't seem to be working.
Based on the readme, I added github "wojteklukaszuk/Watchdog" ~> 1.0.2
to my Cartfile. Here's the result:
~/B ❯❯❯ carthage update
*** Fetching Watchdog
No available version for github "wojteklukaszuk/Watchdog" satisfies the requirement: ~> 1.0.2
So I removed ~> 1.0.2
, but it seems Carthage tries to build the example project instead of the Framework:
~/B ❯❯❯ carthage update
*** Fetching Watchdog
*** Checking out Watchdog at "1.0.1"
*** xcodebuild output can be found in /var/folders/ws/xc68hw2j7kb5l6hqtmz0kh7m0000gn/T/carthage-xcodebuild.AfTOro.log
Project "Example.xcodeproj" has no shared schemes
Watchdog is so cool, it works well, when watchdog find on the main thread is blocking, and I want to know who block the main thread. but I do not know how to print the callstack?
Nice library!
I tried with strictMode: true is not working at all when using Carthage, but if I copied Watchdog.swift and it is working perfectly now.
Hope you can fix it, Thanks!
How to output the information about the blocking context (i.e. the function, code that is blocking)?
Am I missing something?
I wrote some code in viewDidLoad() of a VC to block the main thread for seconds (just a long loop), and the watchdog won't fire (not printing anything). Am I missing something?
Hi!
You plan to support objective-c projects?
('Was Created/Downloaded: ', '/Users/username/Downloads/LoadConf (1).pdf.crdownload')
`
import sys
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class Event(FileSystemEventHandler):
def on_created(self, event):
print('Was Created/Downloaded: ', event.src_path)
if name == 'main':
path = sys.argv[1] if len(sys.argv) > 1 else '.'
event_handler = Event()
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()
try:
while True:
time.sleep(5)
print('Waiting for a change...')
except KeyboardInterrupt:
observer.stop()
observer.join()
`
Watchdog is very useful, thanks a lot, but I have a problem:
During normal execution of my app, I can set a rather small timeout time, say 0.5 sec. This works fine.
However, I have a number of unit stress tests that use unrealistic large data, just to identify potential bottlenecks. To setup these tests, the main thread is busy more than the timeout time of 0.5 sec.
I could of course increase it, but then I would not catch certain problems.
So, what I would like to do is either to disable Watchdog only during the execution of my test setup, or change its timeout time.
Is this possible?
In the v1.x, the duration logs in the console was the duration of how long the main thread has been blocked. Starting with the 2.0, the duration is always displaying the threshold duration.
That's a sad regression, it was a really interesting feature. Do you think to bring it back?
Noticed that the version that gets installed with pod install
does not include the callback
What are your plans to support Swift3?
[!] Unable to find a specification for
Watchdog`
I realised that the watchdog (of course) times out when the execution stops at a breakpoint. Does this really mean that I have to disable the initialisation of the watchdog normally during development, and enable it only when the app is running "freely"?
Is there a reason to not support OS X? I didn't try it out yet, but looking at the code, I didn't see anything blocking
Do I have to remove watchdog when I build for the app-store?
This looks like a port of existing Objective-C code that's floated around for a while. You should probably give credit to the original
https://gist.github.com/jspahrsummers/419266f5231832602bec
There may be other implementations out there to but that's what I found with a quick search.
Nobody can initialize this class due to this issue.
You should probably change it to:
public init(_ threshold: Double = 0.2) {
It might be very handy.
When It's switched to main thread, and execute
self.pingTaskIsRunning = false
self.semaphore.signal()
Is it will consume main thread resources too much, if I set threshold
a little number(just like 50 ms)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.